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=112&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"(1556ms)

aimain.tsx3 matches

@kakiagpUpdated 9 months 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) {

browserbase_google_concertsmain.tsx3 matches

@koraUpdated 9 months ago
1import puppeteer from "https://deno.land/x/puppeteer@16.2.0/mod.ts";
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3import { Browserbase } from "npm:@browserbasehq/sdk";
4
31
32// ask chat gpt for list of concert dates
33const openai = new OpenAI();
34
35const completion = await openai.chat.completions.create({
36 messages: [
37 { role: "system", content: "Return concert dates as JSON array. No code fences." },

ownOpenAImain.tsx4 matches

@koraUpdated 9 months ago
1import { OpenAI } from "npm:openai";
2
3const openai = new OpenAI();
4const completion = await openai.chat.completions.create({
5 "messages": [
6 { "role": "user", "content": "คุณรู้จัก Gemini ไหม" },
7 ],
8 model: "gpt-4o", // ถ้าใช้ของ std/openai จะได้แค่ gpt-4o-mini
9 max_tokens: 30,
10});

ownOpenAIREADME.md1 match

@koraUpdated 9 months ago
1Use my own OpenAI API key to avoid limit

valleGetValsContextWindowmain.tsx4 matches

@stevekrouseUpdated 9 months ago
163 },
164 {
165 prompt: "Write a val that uses OpenAI",
166 code: `import { OpenAI } from "https://esm.town/v/std/openai";
167
168 const openai = new OpenAI();
169 const completion = await openai.chat.completions.create({
170 "messages": [
171 { "role": "user", "content": "Say hello in a creative way" },

openaiDefinerREADME.md1 match

@willthereaderUpdated 9 months ago
1Migrated from folder: finishedProject/forumTextDefiner/openaiDefiner

openaiproxyREADME.md2 matches

@mmrechUpdated 9 months ago
1# OpenAI Proxy
2
3This OpenAI API proxy injects Val Town's API keys. For usage documentation, check out https://www.val.town/v/std/openai

openaiproxymain.tsx8 matches

@mmrechUpdated 9 months ago
1import { parseBearerString } from "https://esm.town/v/andreterron/parseBearerString";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { OpenAIUsage } from "https://esm.town/v/std/OpenAIUsage";
4import { RateLimit } from "npm:@rlimit/http";
5const client = new OpenAIUsage();
6
7const allowedPathnames = [
41
42 // Proxy the request
43 const url = new URL("." + pathname, "https://api.openai.com");
44 url.search = search;
45
46 const headers = new Headers(req.headers);
47 headers.set("Host", url.hostname);
48 headers.set("Authorization", `Bearer ${Deno.env.get("OPENAI_API_KEY")}`);
49 headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
50
51 const modifiedBody = await limitFreeModel(req, user);
62 });
63
64 const openAIRes = await fetch(url, {
65 method: req.method,
66 headers,
70
71 // Remove internal header
72 const res = new Response(openAIRes.body, openAIRes);
73 res.headers.delete("openai-organization");
74 return res;
75}

infiniteSVGGraphmain.tsx3 matches

@maxmUpdated 9 months ago
1import { sha256 } from "https://denopkg.com/chiefbiiko/sha256@v1.0.0/mod.ts";
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3import { OpenAI } from "https://esm.town/v/std/openai?v=4";
4import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite?v=6";
5import { Hono } from "npm:hono@3";
392const app = new Hono();
393app.post("/remix/:id", async (c) => {
394 const openai = new OpenAI();
395 const { prompt } = await c.req.json();
396 let svg = await getSVG(c.req.param("id") as string);
397 if (svg === undefined) return c.text("Not found", 404);
398 const stream = await openai.chat.completions.create({
399 messages: [
400 { role: "user", content: "make me an svg image" },

greenCowREADME.md1 match

@willthereaderUpdated 9 months ago
1# ChatGPT Implemented in Val Town
2
3Demonstrated how to use assistants and threads with the OpenAI SDK and how to stream the response with Server-Sent Events

translateToEnglishWithOpenAI1 file match

@shlmtUpdated 14 hours ago

testOpenAI1 file match

@stevekrouseUpdated 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": "*",