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/$%7Bsuccess?q=openai&page=58&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 3218 results for "openai"(1619ms)

honeydewtwomain.tsx3 matches

@join•Updated 1 month ago
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3
4// --- TYPE DEFINITIONS ---
367}
368export default async function(req: Request): Promise<Response> {
369 const openai = new OpenAI();
370 const url = new URL(req.url);
371 const CORS_HEADERS = {
393 conversation.splice(conversation.length - 1, 0, contextMessage);
394 }
395 const completion = await openai.chat.completions.create({
396 model,
397 messages: [{ role: "system", content: CHAT_PROMPT }, ...conversation],

assistant-requestmain.tsx1 match

@stevenbdf•Updated 1 month ago
16 },
17 ],
18 provider: "openai",
19 maxTokens: 250,
20 temperature: 0.3,

untitled-5244main.tsx12 matches

@join•Updated 1 month ago
2// It uses the Hono web framework to serve a Single-Page Application (SPA).
3
4import { OpenAI } from "https://esm.town/v/std/openai";
5import { Hono } from "npm:hono@4.4.12";
6import type { Context } from "npm:hono@4.4.12";
746 if (!industry) return c.json({ error: "Industry is a required field." }, 400);
747 try {
748 const openai = new OpenAI();
749 const completion = await openai.chat.completions.create({
750 model: "gpt-4o",
751 messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, {
767 if (!occupation) return c.json({ error: "Occupation is a required field." }, 400);
768 try {
769 const openai = new OpenAI();
770 const completion = await openai.chat.completions.create({
771 model: "gpt-4o",
772 messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, {
793
794 try {
795 const openai = new OpenAI();
796 const completion = await openai.chat.completions.create({
797 model: "gpt-4o",
798 messages: [{ role: "system", content: PROMPT_REFINER_SYSTEM_PROMPT }, { role: "user", content: userInput }],
811 if (!refined_prompt) return c.json({ error: "refined_prompt is required" }, 400);
812 try {
813 const openai = new OpenAI();
814 const completion = await openai.chat.completions.create({
815 model: "gpt-4o",
816 messages: [{ role: "system", content: INPUT_EXTRACTOR_SYSTEM_PROMPT }, {
851
852 try {
853 const openai = new OpenAI();
854 const agentCompletion = await openai.chat.completions.create({
855 model: "gpt-4o",
856 messages: [{ role: "system", content: systemPromptWithContext }, {
862 if (!agentOutput) throw new Error("The agent returned no content.");
863
864 const htmlCompletion = await openai.chat.completions.create({
865 model: "gpt-4o",
866 messages: [{ role: "system", content: HTML_FORMATTER_SYSTEM_PROMPT }, { role: "user", content: agentOutput }],

Repairmain.tsx6 matches

@real•Updated 1 month ago
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3import { Hono } from "npm:hono@4.4.12";
4
371// --- BACKEND LOGIC (ADAPTED FOR NEW DOMAIN) ---
372const app = new Hono();
373const openai = new OpenAI();
374
375// This function is domain-agnostic and reusable.
376async function generatePersonaPrompt(occupation: string, task: string) {
377 const completion = await openai.chat.completions.create({
378 model: "gpt-4o",
379 messages: [
394 error: "Quota Exceeded",
395 message:
396 "The application's OpenAI quota has been exceeded. Please check the account dashboard on the OpenAI platform.",
397 }, 429);
398 }
407 const { image } = await c.req.json();
408 if (!image) return c.json({ error: "Image is required." }, 400);
409 const completion = await openai.chat.completions.create({
410 model: "gpt-4o",
411 messages: [
451 }
452
453 const completion = await openai.chat.completions.create({
454 model: "gpt-4o",
455 messages: history,

Townmain.tsx3 matches

@real•Updated 1 month ago
4import { Hono } from "npm:hono@4.4.12";
5import type { Context } from "npm:hono@4.4.12";
6import { OpenAI } from "npm:openai@4.52.7";
7
8// --- TYPE DEFINITIONS ---
193
194 try {
195 const openai = new OpenAI();
196 const completion = await openai.chat.completions.create({
197 model: "gpt-4o",
198 messages: [

MYOPENmain.tsx3 matches

@BUN_SCF•Updated 1 month ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function(req: Request): Promise<Response> {
11 });
12 }
13 const openai = new OpenAI();
14
15 try {
28 }
29
30 const stream = await openai.chat.completions.create(body);
31
32 if (!body.stream) {
rss

rsscontent.json1 match

@artivilla•Updated 1 month ago
10 "https://kill-the-newsletter.com/feeds/sqpw3htkhocwl299i9t8.xml",
11 "https://kill-the-newsletter.com/feeds/ejryrzls9ipgrjbhy51k.xml",
12 "https://openai.com/news/rss.xml",
13 "https://raw.githubusercontent.com/Olshansk/rss-feeds/main/feeds/feed_anthropic_news.xml",
14 "https://raw.githubusercontent.com/Olshansk/rss-feeds/main/feeds/feed_ollama.xml",

shinemain.tsx12 matches

@join•Updated 1 month ago
4import { Hono } from "npm:hono@4.4.12";
5import type { Context } from "npm:hono@4.4.12";
6import { OpenAI } from "npm:openai@4.52.7";
7
8// --- TYPE DEFINITIONS ---
573 if (!industry) return c.json({ error: "Industry is a required field." }, 400);
574 try {
575 const openai = new OpenAI();
576 const completion = await openai.chat.completions.create({
577 model: "gpt-4o",
578 messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, {
594 if (!occupation) return c.json({ error: "Occupation is a required field." }, 400);
595 try {
596 const openai = new OpenAI();
597 const completion = await openai.chat.completions.create({
598 model: "gpt-4o",
599 messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, {
616 const userInput = `Occupation: ${occupation_title}, Task: ${task}`;
617 try {
618 const openai = new OpenAI();
619 const completion = await openai.chat.completions.create({
620 model: "gpt-4o",
621 messages: [{ role: "system", content: PROMPT_REFINER_SYSTEM_PROMPT }, { role: "user", content: userInput }],
634 if (!refined_prompt) return c.json({ error: "refined_prompt is required" }, 400);
635 try {
636 const openai = new OpenAI();
637 const completion = await openai.chat.completions.create({
638 model: "gpt-4o",
639 messages: [{ role: "system", content: INPUT_EXTRACTOR_SYSTEM_PROMPT }, {
662
663 try {
664 const openai = new OpenAI();
665 const agentCompletion = await openai.chat.completions.create({
666 model: "gpt-4o",
667 messages: [{ role: "system", content: finalUserPrompt }, {
673 if (!agentOutput) throw new Error("The agent returned no content.");
674
675 const htmlCompletion = await openai.chat.completions.create({
676 model: "gpt-4o",
677 messages: [{ role: "system", content: HTML_FORMATTER_SYSTEM_PROMPT }, { role: "user", content: agentOutput }],

plantsmain.tsx6 matches

@join•Updated 1 month ago
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3import { Hono } from "npm:hono@4.4.12";
4
399// --- BACKEND LOGIC ---
400const app = new Hono();
401const openai = new OpenAI();
402
403async function generatePersonaPrompt(occupation: string, task: string) {
404 const completion = await openai.chat.completions.create({
405 model: "gpt-4o",
406 messages: [
421 error: "Quota Exceeded",
422 message:
423 "The application's OpenAI quota has been exceeded. Please check the account dashboard on the OpenAI platform.",
424 }, 429);
425 }
434 const { image } = await c.req.json();
435 if (!image) return c.json({ error: "Image is required." }, 400);
436 const completion = await openai.chat.completions.create({
437 model: "gpt-4o",
438 messages: [
478 }
479
480 const completion = await openai.chat.completions.create({
481 model: "gpt-4o",
482 messages: history,

Towniesystem_prompt.txt4 matches

@loganlinn•Updated 1 month 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" },

hello-realtime5 file matches

@jubertioai•Updated 3 days ago
Sample app for the OpenAI Realtime API

openai-gemini1 file match

@ledudu•Updated 1 week 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