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=17&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 1572 results for "openai"(542ms)

buildmoi2a1gpt3 matches

@dcm31•Updated 2 weeks ago
186
187export default async function server(request: Request): Promise<Response> {
188 const { OpenAI } = await import("https://esm.town/v/std/openai");
189 const openai = new OpenAI();
190
191 if (request.method === "POST") {
194
195 if (url.pathname === "/chat") {
196 const completion = await openai.chat.completions.create({
197 messages: [
198 {

stevensDemo.cursorrules4 matches

@zhichu•Updated 2 weeks 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" },

sedateBrownConstrictormain.tsx2 matches

@M_Usman•Updated 2 weeks ago
7 async generate(prompt: string, options: { maxTokens?: number } = {}) {
8 try {
9 const response = await fetch("https://api.openai.com/v1/chat/completions", {
10 method: "POST",
11 headers: {
12 "Content-Type": "application/json",
13 "Authorization": `Bearer ${Deno.env.get("OPENAI_API_KEY")}`,
14 },
15 body: JSON.stringify({

stevensDemosendDailyBrief.ts9 matches

@turtlemon•Updated 2 weeks ago
2import { Bot } from "https://deno.land/x/grammy@v1.35.0/mod.ts";
3import { DateTime } from "https://esm.sh/luxon@3.4.4";
4import OpenAI from "npm:openai@4.5.0";
5import { BOT_SENDER_ID, BOT_SENDER_NAME, storeChatMessage } from "../importers/handleTelegramMessage.ts";
6import { formatMemoriesForPrompt, getRelevantMemories } from "../memoryUtils.ts";
23
24async function generateBriefingContent(
25 openai: OpenAI,
26 memories: unknown[],
27 today: DateTime,
49`.trim();
50
51 const completion = await openai.chat.completions.create({
52 model: "gpt-4",
53 messages: [
68 // 1. Récupérer variables
69 const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
70 const openaiKey = Deno.env.get("OPENAI_API_KEY");
71 if (!telegramToken || !openaiKey) {
72 console.error("🚨 TELEGRAM_TOKEN et/ou OPENAI_API_KEY manquant·e·s");
73 return;
74 }
81 }
82
83 // 2. Initialiser OpenAI et Bot
84 const openai = new OpenAI({ apiKey: openaiKey });
85 const bot = new Bot(telegramToken);
86
94 // 5. Générer le contenu
95 console.log("📝 Generating briefing content...");
96 const content = await generateBriefingContent(openai, memories, today);
97 console.log("📨 Briefing content received");
98

tuckerStevens2.cursorrules4 matches

@tuckerwilde•Updated 2 weeks 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" },

stevensDemogenerateFunFacts.ts8 matches

@turtlemon•Updated 2 weeks ago
3import { nanoid } from "https://esm.sh/nanoid@5.0.5";
4import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
5import OpenAI from "npm:openai@4.5.0";
6
7// Nom de la table et tag
73}
74
75// Génère les fun facts via OpenAI ChatGPT‑4
76async function generateFunFacts(previousFacts: {date: string; text: string}[]) {
77 const openaiKey = Deno.env.get("OPENAI_API_KEY");
78 if (!openaiKey) {
79 console.error("OpenAI API key is not configured.");
80 return [];
81 }
82 const openai = new OpenAI({ apiKey: openaiKey });
83
84 // Prépare le contexte des anciens faits
125
126 try {
127 const completion = await openai.chat.completions.create({
128 model: "gpt-4",
129 messages: [
138 return facts;
139 } catch (e) {
140 console.error("Error generating fun facts with OpenAI:", e);
141 return [];
142 }

stevensDemo.cursorrules4 matches

@turtlemon•Updated 2 weeks 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" },

tuckerStevens.cursorrules4 matches

@tuckerwilde•Updated 2 weeks 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" },

stevensDemoRemix.cursorrules4 matches

@miky•Updated 2 weeks 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" },

stevensDemo.cursorrules4 matches

@miky•Updated 2 weeks 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" },

testOpenAI1 file match

@stevekrouse•Updated 4 hours ago

testOpenAI1 file match

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