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=31&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 2139 results for "openai"(653ms)

qriseREADME.md1 match

@BathSalt1•Updated 2 weeks ago
47- **Frontend**: React with TypeScript
48- **Visualizations**: Canvas API, SVG animations
49- **AI Simulation**: OpenAI API for entity communication
50- **Data Storage**: Val Town blob storage
51- **Styling**: TailwindCSS with custom neon effects

con-juanindex.html1 match

@Downchuck•Updated 2 weeks ago
205 await handlePatternsExample(typingIndicator);
206 } else {
207 // For general questions, use the OpenAI API
208 await handleGeneralQuestion(question, typingIndicator);
209 }

Towniesystem_prompt.txt4 matches

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

Townie.cursorrules4 matches

@roadlabs•Updated 2 weeks 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" },

autonomous-valREADME.md1 match

@all•Updated 2 weeks ago
7Configure the following variables in your environment:
8- `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)
9- `OPENAI_API_KEY` (An OpenAI API Key)
10- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
11

autonomous-valagent.tsx2 matches

@all•Updated 2 weeks ago
1import { anthropic } from "npm:@ai-sdk/anthropic";
2import { openai } from "npm:@ai-sdk/openai";
3import { generateText, streamText } from "npm:ai";
4import { getSystemPrompt } from "./prompt.tsx";
34 const maxSteps = 10;
35
36 const model = Deno.env.get("ANTHROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
37
38 const options = {

autonomous-valagent.tsx2 matches

@abrinz•Updated 2 weeks ago
1import { anthropic } from "npm:@ai-sdk/anthropic";
2import { openai } from "npm:@ai-sdk/openai";
3import { generateText, streamText } from "npm:ai";
4import { getSystemPrompt } from "./prompt.tsx";
34 const maxSteps = 10;
35
36 const model = Deno.env.get("ANTHROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
37
38 const options = {

untitled-7748telegram-image-bot.ts7 matches

@Rajparbat01•Updated 2 weeks ago
1// Telegram Bot that uses OpenAI's DALL-E to generate images
2import { OpenAI } from "https://esm.town/v/std/openai";
3
4// Initialize OpenAI client
5const openai = new OpenAI();
6
7// Telegram Bot API types
91}
92
93// Function to generate an image using OpenAI's DALL-E
94async function generateImage(prompt: string) {
95 try {
96 const response = await openai.images.generate({
97 model: "dall-e-3",
98 prompt: prompt,
123 chatId,
124 "👋 Welcome to the Image Generation Bot!\n\n" +
125 "I can generate images based on your descriptions using OpenAI's DALL-E model.\n\n" +
126 "Simply send me a description of the image you want to create, and I'll generate it for you.\n\n" +
127 "For example: *A serene lake surrounded by mountains at sunset*"
Hubspot-Research

Hubspot-Research.cursorrules4 matches

@charmaine•Updated 2 weeks 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" },

nightwatchmain.tsx16 matches

@join•Updated 2 weeks ago
1// Val Town Narrative Engine with Integrated Test UI
2// =============================================================================
3import { OpenAI } from "https://esm.town/v/std/openai"; // Val Town's OpenAI integration
4// import { Env } from "https://esm.town/v/std/env"; // Not needed if OpenAI() handles API key
5
6// --- Configuration & Constants ---
7const OPENAI_MODEL = "gpt-4o";
8const MAX_TOKENS_RESPONSE = 700;
9
127}
128
129// --- OpenAI System Prompt (same as before) ---
130const SYSTEM_PROMPT = `
131You are a Rick and Morty-styled transdimensional narrative engine, probably cobbled together by Rick in a drunken stupor. Your primary role is to generate hilariously chaotic, compelling, and atmospherically bizarre narrative turns for an epic journey to save the multiverse (or, you know, whatever Rick feels like doing).
549 } = ensureDefaultsAndInferStates(inputContext);
550
551 const contextForOpenAI = {
552 ...processedContext,
553 _inferred_states_for_your_convenience: {
558 };
559 const userMessage = `Input Context JSON (with inferred states for your reference):\n${
560 JSON.stringify(contextForOpenAI, null, 2)
561 }`;
562
563 try {
564 const openai = new OpenAI();
565 const completion = await openai.chat.completions.create({
566 model: OPENAI_MODEL,
567 response_format: { type: "json_object" },
568 messages: [
576 const rawContent = completion.choices[0]?.message?.content;
577 if (!rawContent) {
578 console.error("OpenAI returned an empty response message.");
579 return new Response(
580 JSON.stringify(
581 getFallbackOutput("OpenAI empty response.", processedContext),
582 ),
583 { status: 500, headers: { "Content-Type": "application/json" } },
595 ) {
596 console.error(
597 "OpenAI response missing critical fields or incorrect structure.",
598 JSON.stringify(generatedJson, null, 2),
599 );
602 JSON.stringify(
603 getFallbackOutput(
604 "OpenAI response schema validation failed after generation.",
605 processedContext,
606 ),
618 });
619 } catch (error) {
620 console.error("Error during OpenAI API call or processing:", error);
621 let errorMessage = "Internal server error";
622 if (error.response && error.response.data && error.response.data.error) { // More specific OpenAI error
623 errorMessage = `OpenAI API Error: ${error.response.data.error.message}`;
624 } else if (error.message) {
625 errorMessage = error.message;

openai-client1 file match

@cricks_unmixed4u•Updated 2 days ago

openai_enrichment6 file matches

@stevekrouse•Updated 4 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