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?q=openai&page=14&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 2470 results for "openai"(5287ms)

untitled-7369main.tsx1 match

@handshake5424•Updated 1 week ago
3
4const html = await fetchText(
5 "https://en.wikipedia.org/wiki/OpenAI",
6);
7const $ = load(html);

habitualmain.tsx5 matches

@legal•Updated 1 week ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3// --- TYPE DEFINITIONS ---
892 try {
893 if (req.method === "POST") {
894 const openai = new OpenAI();
895 const body = await req.json();
896
897 switch (action) {
898 case "suggestHabit": {
899 const completion = await openai.chat.completions.create({
900 model: "gpt-4o",
901 messages: [
910 }
911 case "suggestHabitSet": {
912 const completion = await openai.chat.completions.create({
913 model: "gpt-4o",
914 messages: [
923 }
924 case "suggestIcons": {
925 const completion = await openai.chat.completions.create({
926 model: "gpt-4o",
927 messages: [

send-transcriptsREADME.md10 matches

@sunnyatlightswitch•Updated 1 week ago
13- Send transcript content via email to multiple recipients
14- Save all transcripts to Supabase database for persistence
15- Generate AI-powered summaries using OpenAI GPT-4o-mini
16- Save summaries to final reports table
17- Generate secure access tokens for each report
641. **Email Delivery** - Sends the transcript to configured recipients
652. **Transcript Storage** - Saves the original transcript to the `transcripts` table
663. **AI Summarization** - Uses OpenAI GPT-4o-mini to generate a professional summary
674. **Final Report Storage** - Saves the AI-generated summary to the `final_reports` table
685. **Token Generation** - Creates a secure access token in the `pricing_wizard_report_tokens` table
1053. **Configure environment variables** (optional - falls back to hardcoded keys):
106 - `SUPABASE_SERVICE_KEY`
107 - `OPENAI_API_KEY`
108 - `RESEND_API_KEY`
1094. **Test the API** with a sample message
139- **Body:** The AI-generated summary of the transcript
140- **Email:** The email address of the person who submitted the original transcript
141- **OpenAI Thread ID:** Unique identifier from OpenAI for the completion request
142- **ID:** UUID primary key (automatically generated)
143- **Created At:** Timestamp of summary creation (automatically set by database)
148 id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
149 email TEXT NOT NULL,
150 openai_thread_id TEXT NOT NULL,
151 body TEXT NOT NULL,
152 created_at TIMESTAMPTZ DEFAULT NOW(),
177## AI Summarization
178
179The API uses OpenAI's GPT-4o-mini model to generate professional summaries of transcripts. The AI is prompted to:
180- Focus on key points and decisions made
181- Identify action items and important details
185Each AI-generated summary is associated with:
186- The original submitter's email address
187- The unique OpenAI completion ID for traceability
188
189### AI Configuration
191- **Max Tokens:** 1000
192- **Temperature:** 0.3 (for consistent, focused summaries)
193- **API Key:** Configured via environment variable `OPENAI_API_KEY`
194- **Completion Tracking:** Each summary includes the OpenAI completion ID for audit purposes
195
196### Database Configuration
199- **Supabase Project ID:** ffilnpatwtlzjrfbmvxk
200- **Supabase Service Role Key:** Configured via environment variable `SUPABASE_SERVICE_KEY`
201- **OpenAI API Key:** Configured via environment variable `OPENAI_API_KEY`
202
203### Error Handling

stevensDemo.cursorrules4 matches

@quinnstephens•Updated 1 week 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" },

honeydewtwomain.tsx5 matches

@legal•Updated 1 week ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3// --- TYPE DEFINITIONS ---
327}
328export default async function(req: Request): Promise<Response> {
329 const openai = new OpenAI();
330 const url = new URL(req.url);
331 const CORS_HEADERS = {
343 case "synthesizeProject": {
344 const synthesisContent = `Current Date: ${new Date().toISOString().split("T")[0]}\n\nGoal: ${body.goal}`;
345 const completion = await openai.chat.completions.create({
346 model,
347 messages: [{ role: "system", content: PROJECT_SYNTHESIS_PROMPT }, {
359 JSON.stringify(body.tasks, null, 2)
360 }`;
361 const completion = await openai.chat.completions.create({
362 model,
363 messages: [{ role: "system", content: DAILY_REBALANCE_PROMPT }, {
385 conversation.unshift(contextMessage);
386 }
387 const completion = await openai.chat.completions.create({
388 model,
389 messages: [{ role: "system", content: CHAT_PROMPT }, ...conversation],

llm-tips.cursorrules4 matches

@cricks_unmixed4u•Updated 1 week ago
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },

Sonar.cursorrules4 matches

@moe•Updated 1 week ago
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },

personal_trmnlpolymarket_cron.tsx3 matches

@ramtinalami•Updated 1 week ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4const CACHE_RAW = "polymarket_raw";
5const CACHE_SUMMARY = "polymarket_summary";
6const openai = new OpenAI();
7
8// Calculate date 3 months from now for start_date_min
142
143 // 5) Call AI
144 const aiRes = await openai.chat.completions.create({
145 model: "gpt-4o-mini",
146 messages: [{ role: "user", content: prompt }],

personal_trmnlmalifold_cron.tsx3 matches

@ramtinalami•Updated 1 week ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
6const RAW_URL = "https://api.manifold.markets/v0/markets?limit=100&sort=last-bet-time";
7const DETAIL_URL = (id) => `https://api.manifold.markets/v0/market/${id}`;
8const openai = new OpenAI();
9
10export async function cronValHandler(interval) {
127
128 // 5) Call AI once
129 const aiRes = await openai.chat.completions.create({
130 model: "gpt-4o-mini",
131 messages: [{ role: "user", content: prompt }],

diy-aimain.tsx3 matches

@legal•Updated 1 week ago
362//
363export default async function(req: Request) {
364 const { OpenAI } = await import("https://esm.town/v/std/openai");
365
366 const CORS_HEADERS = {
374 const format = url.searchParams.get("format");
375 const sourceUrl = import.meta.url.replace("esm.town", "val.town");
376 const openai = new OpenAI();
377
378 const jsonResponse = (body: object, status: number) =>
384 ): Promise<object> {
385 try {
386 const response = await openai.chat.completions.create({
387 model: "gpt-4o",
388 messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userMessagePayload }],

openai2 file matches

@wangqiao1234•Updated 1 day ago

openaiproxy2 file matches

@wangqiao1234•Updated 1 day ago
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai"; import { sqlite } from "https://esm.town/v/stevekrouse/sqlite"; /** * Practical Implementation of Collective Content Intelligence * Bridging advanced AI with collaborative content creation */ exp
kwhinnery_openai