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=102&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 2502 results for "openai"(1874ms)

JimeluStevens.cursorrules4 matches

@luke_fUpdated 2 months 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" },

valreadmegeneratormain.tsx3 matches

@dcm31Updated 2 months ago
177 }
178
179 const { OpenAI } = await import("https://esm.town/v/std/openai");
180 const openai = new OpenAI();
181
182 const valTownClient = new ValTown({
197
198 try {
199 const completion = await openai.chat.completions.create({
200 model: "gpt-4o",
201 messages: [

valreadmegeneratorREADME.md1 match

@dcm31Updated 2 months ago
43- **Deno:** The server-side environment.
44- **ValTown SDK:** Integrated to fetch Val details.
45- **OpenAI GPT-4:** To generate natural language README content.
46- **JavaScript Modules (ESM):** For seamless module imports.
47

stevensDemo.cursorrules4 matches

@sajtosmUpdated 2 months 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" },

stevensDemo.cursorrules4 matches

@arawlinsUpdated 2 months 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" },

Futuremain.tsx12 matches

@salonUpdated 2 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
3import * as ta from "npm:technicalindicators";
362}
363
364async function callOpenAI(
365 systemPrompt: string,
366 userMessage: string,
372): Promise<{ role: "assistant" | "system"; content: string }> {
373 const callId = Math.random().toString(36).substring(2, 8);
374 const logPfx = `OpenAI Call [${agentName} ${taskId.split("-")[1] || taskId} ${callId}]`;
375 try {
376  log("DEBUG", agentName, `${logPfx}: Initiating (${model}, JSON: ${isJsonOutputRequired})...`);
377  const openai = new OpenAI();
378  const res = await openai.chat.completions.create({
379   model,
380   messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessage }],
384  const content = res.choices?.[0]?.message?.content;
385  if (!content) {
386   log("ERROR", agentName, `${logPfx}: OpenAI returned empty/invalid response.`);
387   throw new Error("Invalid/empty AI response.");
388  }
394  let code = err.status || (err.response ? err.response.status : null);
395  const errData = err.response?.data || err.error || err.response || err;
396  if (errData?.message) { errMsg = `OpenAI Err (${code || "?"}) via ${agentName}: ${errData.message}`; }
397  else if (errData?.error?.message) { errMsg = `OpenAI Err (${code || "?"}) via ${agentName}: ${errData.error.message}`; }
398  else if (err.message) { errMsg += ` Details: ${err.message}`; }
399  else { try { errMsg += ` Unknown err: ${JSON.stringify(errData)}`; } catch { errMsg += " Unknown non-serializable err."; }}
402  else if (code === 400) errMsg += " (ACTION: Bad request/prompt issue)";
403  else if (err.code === "ENOTFOUND" || err.code === "ECONNREFUSED" || err.cause?.code === "UND_ERR_CONNECT_TIMEOUT") errMsg += " (ACTION: Network error)";
404  else if (code >= 500) errMsg += " (ACTION: OpenAI server issue)";
405  const escapedErr = errMsg.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n");
406  if (isJsonOutputRequired) {
659 const taskId = task.taskId;
660 log("INFO", agentName, `Task ${taskId}. Processing goals. Hash: ${hashCode(JSON.stringify(task.payload))}`);
661 const result = await callOpenAI(
662  tickerSuggestionAgentSystemPrompt,
663  JSON.stringify(task.payload),
999  },
1000 });
1001 const result = await callOpenAI(
1002  tickerInterpretationAgentSystemPrompt,
1003  input,
1111  pastPerformanceContext: pastPerformanceContext ?? "N/A",
1112 });
1113 const result = await callOpenAI(
1114  synthesisChartingDataAgentSystemPrompt,
1115  input,

stevensDemo.cursorrules4 matches

@satcarUpdated 2 months 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" },

stevensDemo.cursorrules4 matches

@ziipoUpdated 2 months 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" },

a1gptmain.tsx6 matches

@dcm31Updated 2 months ago
291
292export default async function server(request: Request): Promise<Response> {
293 // Dynamically import OpenAI only on the server - like DeepSauce
294 const { OpenAI } = await import("https://esm.town/v/std/openai");
295 // Ensure API key is set in environment variables
296 const openai = new OpenAI();
297
298 // Handle POST requests for chat and image generation
318 }
319 try {
320 const completion = await openai.chat.completions.create({
321 messages: [
322 {
335 const messageContent = completion?.choices?.[0]?.message?.content;
336 if (!messageContent) {
337 throw new Error("No content received from OpenAI.");
338 }
339
342 });
343 } catch (error) {
344 console.error("OpenAI Chat API error:", error);
345 return new Response(
346 JSON.stringify({ error: "Failed to get response from AI. Maybe it needs more steak sauce?" }),

stevensDemo.cursorrules4 matches

@BrandonSmithUpdated 2 months 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" },

openai2 file matches

@wangqiao1234Updated 5 days ago

openaiproxy2 file matches

@wangqiao1234Updated 5 days 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