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=59&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 1632 results for "openai"(1134ms)

inquisitiveTealMuskoxmain.tsx3 matches

@mirza•Updated 1 month ago
5
6// Store the API key as a constant or use environment variable
7const OPENAI_API_KEY =
8 "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";
9
116 : "You are an expert guide helping users accelerate their learning and mastery of skills. Provide concise, actionable insights that help people learn faster and more effectively.");
117
118 const response = await fetch("https://api.openai.com/v1/chat/completions", {
119 method: "POST",
120 headers: {
121 "Authorization": `Bearer ${OPENAI_API_KEY}`,
122 "Content-Type": "application/json",
123 },

example_toolmain.tsx2 matches

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
12 }
13 const { text: processedOutput } = await generateText({
14 model: openai("gpt-4o-mini"),
15 system: "You are a helpful assistant.",
16 prompt: "Process the following input based on the requirements: " + body.input,

debatebasemain.tsx5 matches

@api•Updated 2 months ago
770
771export default async function server(request: Request): Promise<Response> {
772 const { OpenAI } = await import("https://esm.town/v/std/openai");
773 const openai = new OpenAI();
774
775 // Enhanced server-side logging
870 `;
871
872 const completion = await openai.chat.completions.create({
873 model: "gpt-4o-mini",
874 response_format: { type: "json_object" },
949 `;
950
951 const completion = await openai.chat.completions.create({
952 model: "gpt-4o-mini",
953 response_format: { type: "json_object" },
1021 `;
1022
1023 const completion = await openai.chat.completions.create({
1024 model: "gpt-4o-mini",
1025 messages: [{ role: "user", content: prompt }],

hello_from_nathanmain.tsx1 match

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3

browserlessScrapeExamplemain.tsx1 match

@vawogbemi•Updated 2 months ago
8 method: "POST",
9 body: JSON.stringify({
10 "url": "https://en.wikipedia.org/wiki/OpenAI",
11 "elements": [{
12 // The second <p> element on the page

name_new_pokemon_based_on_feelingsmain.tsx2 matches

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
12 }
13 const { text: pokemonName } = await generateText({
14 model: openai("gpt-4o-mini"),
15 system: "You are a creative Pokémon name generator.",
16 prompt: "Create a new Pokémon name based on the following feeling: " + body.feeling,

readyChocolatePikemain.tsx2 matches

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
23
24 const { text: gameIdeas } = await generateText({
25 model: openai("gpt-4o-mini"),
26 system: "You are a creative game designer.",
27 prompt: prompt.trim(),

noteworthyAquamarineVipermain.tsx2 matches

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
23
24 const { text: gameIdeas } = await generateText({
25 model: openai("gpt-4o-mini"),
26 system: "You are a creative game designer.",
27 prompt: prompt,

list_pokemon_game_ideasmain.tsx2 matches

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
23
24 const { text: gameIdeas } = await generateText({
25 model: openai("gpt-4o-mini"),
26 system: "You are a creative game designer.",
27 prompt: prompt,

pokemon_game_ideas_listmain.tsx2 matches

@ajax•Updated 2 months ago
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
21
22 const { text: gameIdeas } = await generateText({
23 model: openai("gpt-4o-mini"),
24 system: "You are a creative game designer.",
25 prompt: prompt,

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 6 days ago

testOpenAI1 file match

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