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%22Image%20title%22?q=openai&page=10&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 1581 results for "openai"(502ms)

OpenTowniesystem_prompt.txt4 matches

@charmaine•Updated 1 week 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" },

ChatGPTclonemain.tsx4 matches

@olamultiply•Updated 1 week ago
216
217export default async function server(request: Request): Promise<Response> {
218 const { OpenAI } = await import("https://esm.town/v/std/openai");
219 const openai = new OpenAI();
220
221 if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
225 async start(controller) {
226 try {
227 const chatCompletion = await openai.chat.completions.create({
228 model: "gpt-4o-mini",
229 messages: [
244 }
245 } catch (error) {
246 console.error('OpenAI Error:', error);
247 controller.enqueue(new TextEncoder().encode('Sorry, there was an error processing your request.'));
248 } finally {

vtEditorFiles.cursorrules4 matches

@std•Updated 1 week 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" },

Emotional_Companionmain.tsx4 matches

@Scolly•Updated 1 week ago
543 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
544 const { blob } = await import("https://esm.town/v/std/blob");
545 const { OpenAI } = await import("https://esm.town/v/std/openai");
546 const openai = new OpenAI();
547 const KEY = "Emotional_Companion";
548
646
647 try {
648 const completion = await openai.chat.completions.create({
649 messages: [
650 {
666 });
667 } catch (error) {
668 console.error("OpenAI Error:", error);
669 const fallbackResponses = [
670 "I'm here for you. Let's take a moment to breathe and reflect.",

Testmain.tsx6 matches

@Get•Updated 1 week ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const MODEL = "gpt-4";
6
7async function generateRelatedIdeasBatch(
8 openai: OpenAI,
9 centerIdea: string,
10 count: number = 9,
11): Promise<{ matrix: string[][] } | null> {
12 try {
13 const response = await openai.chat.completions.create({
14 model: MODEL,
15 messages: [
54 const direction = url.searchParams.get("direction");
55
56 const openai = new OpenAI();
57 let matrixToRender: string[][] = [Array(GRID_SIZE).fill("...")];
58
59 if (centerIdea && direction) {
60 const result = await generateRelatedIdeasBatch(openai, centerIdea);
61 if (result && result.matrix) {
62 matrixToRender = result.matrix;
65 }
66 } else if (initialIdea) {
67 const result = await generateRelatedIdeasBatch(openai, initialIdea);
68 if (result && result.matrix) {
69 matrixToRender = result.matrix;

faq_chatbotmain.tsx3 matches

@sunmade•Updated 1 week ago
172export default async function server(request: Request): Promise<Response> {
173 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
174 const { OpenAI } = await import("https://esm.town/v/std/openai");
175 const KEY = "faq_chatbot";
176 const SCHEMA_VERSION = 2;
191 if (new URL(request.url).pathname === "/chat") {
192 const body = await request.json();
193 const openai = new OpenAI();
194
195 const systemPrompt = `You are an AI assistant for TechyJaunt, an eduTech platform that trains Africans in tech skills.
199
200 try {
201 const completion = await openai.chat.completions.create({
202 model: "gpt-4o-mini",
203 messages: [

Val_Geomain.tsx4 matches

@DegVal•Updated 1 week ago
291export default async function server(request: Request): Promise<Response> {
292 if (request.method === "POST" && new URL(request.url).pathname === "/analyze") {
293 const { OpenAI } = await import("https://esm.town/v/std/openai");
294 const openai = new OpenAI();
295
296 const formData = await request.formData();
312
313 try {
314 const response = await openai.chat.completions.create({
315 model: "gpt-4o",
316 messages: [
361 );
362 } catch (error) {
363 console.error("OpenAI Analysis Error:", error);
364 return new Response(
365 JSON.stringify({

stevensDemo.cursorrules4 matches

@mcpolemic•Updated 1 week 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" },

OpenTowniesystem_prompt.txt4 matches

@yakuzadave•Updated 1 week 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" },

TrainingAssistantmain.tsx3 matches

@sach•Updated 1 week ago
418 if (request.method === 'POST' && new URL(request.url).pathname === '/generate-activity') {
419 try {
420 const { OpenAI } = await import("https://esm.town/v/std/openai");
421 const openai = new OpenAI();
422
423 const { teamSize, activityType } = await request.json();
433 name, description, minTeam, maxTeam`;
434
435 const completion = await openai.chat.completions.create({
436 messages: [{ role: "user", content: prompt }],
437 model: "gpt-4o-mini",

testOpenAI1 file match

@stevekrouse•Updated 1 day ago

testOpenAI1 file match

@shouser•Updated 3 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": "*",