Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Optional%20title%22?q=openai&page=50&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=openai

Returns an array of strings in format "username" or "username/projectName"

Found 1670 results for "openai"(855ms)

vtProjectSearchcomponents.tsx2 matches

@charmaineโ€ขUpdated 1 month ago
1215 <a href="?q=function" className="example-link">function</a>
1216 <a href="?q=discord" className="example-link">discord</a>
1217 <a href="?q=openai" className="example-link">openai</a>
1218 <a href="?q=react" className="example-link">react</a>
1219 </div>
1360 <a href="?q=function" className="example-link">function</a>
1361 <a href="?q=discord" className="example-link">discord</a>
1362 <a href="?q=openai" className="example-link">openai</a>
1363 <a href="?q=react" className="example-link">react</a>
1364 </div>

vtProjectSearchcomponents.tsx2 matches

@stevekrouseโ€ขUpdated 1 month ago
1215 <a href="?q=function" className="example-link">function</a>
1216 <a href="?q=discord" className="example-link">discord</a>
1217 <a href="?q=openai" className="example-link">openai</a>
1218 <a href="?q=react" className="example-link">react</a>
1219 </div>
1360 <a href="?q=function" className="example-link">function</a>
1361 <a href="?q=discord" className="example-link">discord</a>
1362 <a href="?q=openai" className="example-link">openai</a>
1363 <a href="?q=react" className="example-link">react</a>
1364 </div>

test1main.tsx15 matches

@AIWBโ€ขUpdated 1 month ago
1// Combined Frontend (React/ChakraUI) and Backend (Hono/OpenAI) for Val Town
2// Funding Assistant Dashboard Prototype - v6 (Corrected AgencyInfo Prompt Logic)
3
509export default async function server(request: Request): Promise<Response> {
510 // Only import server-side dependencies here
511 const { OpenAI } = await import("https://esm.town/v/std/openai");
512 // const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite"); // DB optional
513 const { Hono } = await import("npm:hono");
514
515 // --- OpenAI Client ---
516 // Ensure API key is set as Val Town env var 'openai'
517 let openai;
518 try {
519 openai = new OpenAI();
520 } catch (e) {
521 console.error("FATAL: Failed to initialize OpenAI client. Is the 'openai' environment variable set?", e);
522 // Return a generic server error response if OpenAI cannot be initialized
523 return new Response(JSON.stringify({ error: "Server configuration error. Unable to initialize OpenAI client." }), {
524 status: 500,
525 headers: { "Content-Type": "application/json" },
675 ];
676
677 // --- Call OpenAI ---
678 console.log(`Calling OpenAI for agent: ${agentType}...`);
679 const completion = await openai.chat.completions.create({
680 messages: messages,
681 model: "gpt-4o",
706
707 } catch (error) {
708 // Catches errors in request handling, OpenAI API call itself, etc.
709 console.error(`Critical error initiating agent ${agentType}:`, error);
710 let errorMsg = `Server error initiating agent ${agentType}.`;
711 // Check for specific OpenAI errors if needed for better diagnostics
712 // if (error instanceof OpenAI.APIError) { errorMsg = `OpenAI API Error: ${error.status} ${error.message}`; }
713 else if (error.message) {
714 errorMsg = `${errorMsg} Details: ${error.message}`;

OpenTownietownie.mdc4 matches

@nuloโ€ขUpdated 1 month ago
54Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
55
56### OpenAI
57
58```ts
59import { OpenAI } from "https://esm.town/v/std/openai";
60const openai = new OpenAI();
61const completion = await openai.chat.completions.create({
62 messages: [
63 { role: "user", content: "Say hello in a creative way" },

OpenTowniesystem_prompt.txt4 matches

@nuloโ€ขUpdated 1 month ago
49Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
50
51### OpenAI
52
53```ts
54import { OpenAI } from "https://esm.town/v/std/openai";
55const openai = new OpenAI();
56const completion = await openai.chat.completions.create({
57 messages: [
58 { role: "user", content: "Say hello in a creative way" },

reactRouter7ExampleTODO.md1 match

@stevekrouseโ€ขUpdated 1 month ago
1- [ ] Get OpenTownie or Gemini or Claude or OpenAI to synthesize the core of these patterns into a prompt we can use to make more ReactRouter apps, such as...
2- [ ] Convert this or into the basic react router guest book (and preserve this forum app in another project?)
3- [ ] To what extent can these patterns be packaged up into a Val Town Router project? Would be neat to get the version pinning thing all centralized, can this as-a-library be that centralized place?

reactRouter7ExampleTODO.md1 match

@tmcwโ€ขUpdated 1 month ago
28## Other todos
29
30- [ ] Get OpenTownie or Gemini or Claude or OpenAI to synthesize the core of these patterns into a prompt we can use to make more ReactRouter apps, such as...
31- [ ] Convert this or into the basic react router guest book (and preserve this forum app in another project?)
32- [ ] To what extent can these patterns be packaged up into a Val Town Router project? Would be neat to get the version pinning thing all centralized, can this as-a-library be that centralized place?

stevens.cursorrules4 matches

@geoffreylittโ€ขUpdated 1 month ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

blogget-old-posts.ts5 matches

@cdignamโ€ขUpdated 1 month ago
198 },
199 {
200 "title": "An Introduction to OpenAI fine-tuning",
201 "slug": "an-introduction-to-openai-fine-tuning",
202 "link": "/blog/an-introduction-to-openai-fine-tuning",
203 "description": "How to customize OpenAI to your liking",
204 "pubDate": "Fri, 25 Aug 2023 00:00:00 GMT",
205 "author": "Steve Krouse",
417 "slug": "val-town-newsletter-16",
418 "link": "/blog/val-town-newsletter-16",
419 "description": "Our seed round, growing team, Codeium completions, @std/openai, and more",
420 "pubDate": "Mon, 22 Apr 2024 00:00:00 GMT",
421 "author": "Steve Krouse",

chatREADME.md8 matches

@loadingโ€ขUpdated 1 month ago
1# AI Chat App
2
3A sleek, dark-themed AI chat application built with React on Val Town using the OpenAI API.
4
5## Features
7- React-based chat interface with component architecture
8- Elegant dark theme with purple/indigo accents
9- Powered by OpenAI's GPT models
10- Modern, responsive design with Tailwind CSS
11- TypeScript for type safety and better developer experience
18```
19โ”œโ”€โ”€ backend/
20โ”‚ โ””โ”€โ”€ index.ts # Backend API with Hono and OpenAI integration
21โ”œโ”€โ”€ frontend/
22โ”‚ โ”œโ”€โ”€ components/ # React components
342. Messages are managed with React state
353. API requests are sent to the backend endpoint
364. The backend uses the OpenAI API to generate responses
375. Responses are formatted with enhanced markdown support and displayed in the chat interface
386. UI includes loading indicators and smooth animations for better user experience
44- **Tailwind CSS**: For styling without custom CSS files
45- **Hono**: Lightweight web framework for the backend
46- **OpenAI API**: For generating AI responses
47- **CSS Animations**: For smooth transitions and loading indicators
48
49## Requirements
50
51This app requires an OpenAI API key to be set as an environment variable in Val Town.
52
53## Setup
54
551. Fork this project in Val Town
562. Add your OpenAI API key as an environment variable named `OPENAI_API_KEY`
573. Run the project
58
61You can customize the app by:
62- Modifying React components to add new features
63- Changing the OpenAI model in the backend (currently using gpt-4o-mini)
64- Adjusting the max tokens parameter for longer or shorter responses
65- Modifying the color scheme by changing the Tailwind classes

translateToEnglishWithOpenAI1 file match

@shlmtโ€ขUpdated 1 week ago

testOpenAI1 file match

@stevekrouseโ€ขUpdated 1 week ago
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",