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/$%7Bart_info.art.src%7D?q=openai&page=42&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 1594 results for "openai"(905ms)

cronREADME.md1 match

@stevekrouse•Updated 3 weeks ago
8* Hono JSX
9* HTMX (probably overcomplicates things; should remove)
10* @stevekrouse/openai, which is a light wrapper around @std/openai
11
12I'm finding HTMX a bit overpowered for this, so I have two experimental forks without it:

emailSummaryHandlermain.tsx3 matches

@twseoking•Updated 3 weeks ago
2import { email } from "https://esm.town/v/std/email";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4import { OpenAI } from "npm:openai";
5
6function stripHtmlBackticks(html: string): string {
9
10export default async function(e: Email) {
11 const openai = new OpenAI();
12 console.log(`from: ${e.from} to: ${e.to} subject: ${e.subject}, cc: ${e.cc}, bcc: ${e.bcc}`);
13
25 }
26
27 const summary = await openai.chat.completions.create({
28 messages: [
29 {

researchAgentemailHandler2 matches

@twseoking•Updated 3 weeks ago
2import process from "node:process";
3import { marked } from "npm:marked";
4import { OpenAI } from "npm:openai";
5
6function pm(...lines: string[]): string {
16 );
17
18 const client = new OpenAI({ apiKey: process.env.PERPLEXITY_API_KEY, baseURL: "https://api.perplexity.ai" });
19 const response = await client.chat.completions.create({
20 model: "sonar",

vtProjectSearch2components.tsx2 matches

@charmaine•Updated 3 weeks 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

@charmaine•Updated 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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?

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 12 hours ago

testOpenAI1 file match

@stevekrouse•Updated 2 days 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": "*",