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/?q=openai&page=5&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 345 results for "openai"(559ms)

buildmoi2a1gpt3 matches

@dcm31•Updated 5 days 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 5 days 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" },

stevensDemosendDailyBrief.ts9 matches

@turtlemon•Updated 5 days 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 5 days 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 5 days 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 5 days 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 5 days 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 6 days 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 6 days 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

@swriddle•Updated 6 days 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" },

stevens-openai5 file matches

@yash_ing•Updated 1 day ago

openaiPricing9 file matches

@nbbaier•Updated 1 week ago
Project created from val URLs