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/$1?q=openai&page=34&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 2571 results for "openai"(1889ms)

val-town-http-mcp-servervalley_local.txt4 matches

@nbbaier•Updated 1 month ago
71```
72
73### OpenAI Integration
74```typescript
75import { OpenAI } from "https://esm.town/v/std/openai";
76const openai = new OpenAI();
77const completion = await openai.chat.completions.create({
78 messages: [{ role: "user", content: "Say hello" }],
79 model: "gpt-4o-mini",

val-town-http-mcp-servertownie.txt7 matches

@nbbaier•Updated 1 month ago
83
84 <library>
85 ## OpenAI
86
87 Val Town includes a free, proxied OpenAI:
88
89 ```ts
90 import { OpenAI } from "https://esm.town/v/std/openai";
91 const openai = new OpenAI();
92 const completion = await openai.chat.completions.create({
93 messages: [
94 { role: "user", content: "Say hello in a creative way" },
99 ```
100
101 OpenAI only works on the server. If the val includes client-side code, use dynamic imports to import this module in the server function, e.g.:
102 `const { OpenAI } = await import "https://esm.town/v/std/openai");`
103 </library>
104

val-town-http-mcp-serveropentownie.txt4 matches

@nbbaier•Updated 1 month ago
143Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
144
145### OpenAI
146```ts
147import { OpenAI } from "npm:openai";
148const openai = new OpenAI();
149const completion = await openai.chat.completions.create({
150 messages: [
151 { role: "user", content: "Say hello in a creative way" },

Todomain.tsx3 matches

@svc•Updated 1 month ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3// --- TYPE DEFINITIONS ---
372
373export default async function(req: Request): Promise<Response> {
374 const openai = new OpenAI();
375 const url = new URL(req.url);
376 const CORS_HEADERS = {
411 }
412
413 const completion = await openai.chat.completions.create({
414 model,
415 messages: [{ role: "system", content: prompt }, { role: "user", content: userContent }],
143Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
144
145### OpenAI
146```ts
147import { OpenAI } from "npm:openai";
148const openai = new OpenAI();
149const completion = await openai.chat.completions.create({
150 messages: [
151 { role: "user", content: "Say hello in a creative way" },

val-town-http-mcp-servervalley.txt4 matches

@prashamtrivedi•Updated 1 month ago
86Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
87
88### OpenAI
89
90```ts
91import { OpenAI } from "https://esm.town/v/std/openai";
92const openai = new OpenAI();
93const completion = await openai.chat.completions.create({
94 messages: [
95 { role: "user", content: "Say hello in a creative way" },

val-town-http-mcp-servertownie.txt7 matches

@prashamtrivedi•Updated 1 month ago
83
84 <library>
85 ## OpenAI
86
87 Val Town includes a free, proxied OpenAI:
88
89 ```ts
90 import { OpenAI } from "https://esm.town/v/std/openai";
91 const openai = new OpenAI();
92 const completion = await openai.chat.completions.create({
93 messages: [
94 { role: "user", content: "Say hello in a creative way" },
99 ```
100
101 OpenAI only works on the server. If the val includes client-side code, use dynamic imports to import this module in the server function, e.g.:
102 `const { OpenAI } = await import "https://esm.town/v/std/openai");`
103 </library>
104
71```
72
73### OpenAI Integration
74```typescript
75import { OpenAI } from "https://esm.town/v/std/openai";
76const openai = new OpenAI();
77const completion = await openai.chat.completions.create({
78 messages: [{ role: "user", content: "Say hello" }],
79 model: "gpt-4o-mini",

GenerateResponsesGenerateResponses.ts7 matches

@Dentalabcs•Updated 1 month ago
11 console.log("Received:", message, "from", from);
12
13 // Get OpenAI API key
14 const openaiKey = Deno.env.get("OPENAI_API_KEY")!;
15
16 // 1. Ask OpenAI for a response
17 let aiResponse = "Sorry, something went wrong.";
18 try {
19 const openaiRes = await fetch("https://api.openai.com/v1/chat/completions", {
20 method: "POST",
21 headers: {
22 Authorization: `Bearer ${openaiKey}`,
23 "Content-Type": "application/json",
24 },
39 });
40
41 const data = await openaiRes.json();
42 aiResponse = data.choices?.[0]?.message?.content ?? aiResponse;
43 } catch (err) {
44 console.error("OpenAI error:", err);
45 }
46

huyhieu.cursorrules4 matches

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

openai2 file matches

@wangqiao1234•Updated 2 weeks ago

openaiproxy2 file matches

@wangqiao1234•Updated 2 weeks ago
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai"; import { sqlite } from "https://esm.town/v/stevekrouse/sqlite"; /** * Practical Implementation of Collective Content Intelligence * Bridging advanced AI with collaborative content creation */ exp
kwhinnery_openai