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%22Optional%20title%22?q=openai&page=111&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 1618 results for "openai"(729ms)

valleBlogV0main.tsx3 matches

@lho•Updated 8 months ago
3import { passwordAuth } from "https://esm.town/v/pomdtr/password_auth?v=84";
4import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken?v=1";
5import { openai } from "npm:@ai-sdk/openai";
6import ValTown from "npm:@valtown/sdk";
7import { streamText } from "npm:ai";
36
37 const stream = await streamText({
38 model: openai("gpt-4o", {
39 baseURL: "https://std-openaiproxy.web.val.run/v1",
40 apiKey: Deno.env.get("valtown"),
41 } as any),

townGenREADME.md1 match

@all•Updated 8 months ago
3- [[https://www.val.town/v/stevekrouse/valwriter]]
4
5- _Note_: It looks like openai enhancement was dropped at some point when adding all the gizmos;
6

umapmain.tsx7 matches

@ejfox•Updated 8 months ago
164
165 <div class="example">
166 <h3>Example with OpenAI Embeddings:</h3>
167 <p>This example shows how to use the UMAP service with OpenAI embeddings:</p>
168 <pre>
169// First, generate embeddings using OpenAI API
170import { OpenAI } from "https://esm.town/v/std/openai";
171const openai = new OpenAI();
172
173async function getEmbeddings(texts) {
174 const response = await openai.embeddings.create({
175 model: "text-embedding-ada-002",
176 input: texts,
180
181// Then, use these embeddings with the UMAP service
182const texts = ["Hello world", "OpenAI is amazing", "UMAP reduces dimensions"];
183const embeddings = await getEmbeddings(texts);
184

weatherGPTmain.tsx3 matches

@sarfrazkhan18•Updated 8 months ago
1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3
4let location = "brooklyn ny";
8).then(r => r.json());
9
10const openai = new OpenAI();
11let chatCompletion = await openai.chat.completions.create({
12 messages: [{
13 role: "user",

VALLEREADME.md1 match

@eugenechantk•Updated 8 months ago
6* Fork this val to your own profile.
7* Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in `tempValsParentFolderId`.
8* If you want to use OpenAI models you need to set the `OPENAI_API_KEY` [env var](https://www.val.town/settings/environment-variables).
9* If you want to use Anthropic models you need to set the `ANTHROPIC_API_KEY` [env var](https://www.val.town/settings/environment-variables).
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.

egoBoostermain.tsx7 matches

@stevekrouse•Updated 8 months ago
2 * This ego booster app takes a selfie, sends it to GPT-4o-mini for analysis,
3 * and streams funny, specific compliments about the user's appearance.
4 * We use the WebRTC API for camera access, the OpenAI API for image analysis,
5 * and server-sent events for real-time streaming of compliments.
6 */
186 }
187
188 const { OpenAI } = await import("https://esm.town/v/std/openai");
189 const openai = new OpenAI();
190
191 const stream = new ReadableStream({
196 const base64Image = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
197
198 console.log("Sending request to OpenAI");
199 const completion = await openai.chat.completions.create({
200 model: "gpt-4o-mini",
201 messages: [
216 });
217
218 console.log("Streaming response from OpenAI");
219 for await (const chunk of completion) {
220 const content = chunk.choices[0]?.delta?.content || '';
223 }
224 } catch (error) {
225 console.error('Error in OpenAI processing:', error);
226 controller.enqueue(new TextEncoder().encode("Oops! Our AI had a little hiccup. Maybe your beauty short-circuited it! 🤖💥"));
227 } finally {

VALLErunmain.tsx2 matches

@cofsana•Updated 8 months ago
9import { sleep } from "https://esm.town/v/stevekrouse/sleep?v=1";
10import { anthropic } from "npm:@ai-sdk/anthropic";
11import { openai } from "npm:@ai-sdk/openai";
12import ValTown from "npm:@valtown/sdk";
13import { StreamingTextResponse, streamText } from "npm:ai";
1104 let vercelModel;
1105 if (model.includes("gpt")) {
1106 vercelModel = openai(model);
1107 } else {
1108 vercelModel = anthropic(model);

DailyDaughterNotesmain.tsx4 matches

@heathergliffin•Updated 8 months ago
1/**
2 * This app generates cute daily notes for a daughter using OpenAI's GPT model.
3 * It stores the generated notes in SQLite for persistence and displays them on a simple web interface.
4 * The app uses React for the frontend and Deno's runtime environment in Val Town for the backend.
56
57async function server(request: Request): Promise<Response> {
58 const { OpenAI } = await import("https://esm.town/v/std/openai");
59 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
60 const KEY = "DailyDaughterNotes";
85 }
86 } else if (path === "/generate-note" && request.method === "POST") {
87 const openai = new OpenAI();
88 const completion = await openai.chat.completions.create({
89 messages: [
90 {

VALLEREADME.md1 match

@ttodosi•Updated 8 months ago
6* Fork this val to your own profile.
7* Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in `tempValsParentFolderId`.
8* If you want to use OpenAI models you need to set the `OPENAI_API_KEY` [env var](https://www.val.town/settings/environment-variables).
9* If you want to use Anthropic models you need to set the `ANTHROPIC_API_KEY` [env var](https://www.val.town/settings/environment-variables).
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.

infiniteSVGGraphmain.tsx3 matches

@ttodosi•Updated 8 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" },

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 4 days ago

testOpenAI1 file match

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