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=122&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 3227 results for "openai"(2344ms)

my-first-valindex.ts4 matches

@bami_koleUpdated 3 months ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { OpenAI } from "https://esm.town/v/std/openai";
4import type { CustomerPersona, ChatSession, Message, ChatRequest, ChatResponse } from "../shared/types.ts";
5
11});
12
13const openai = new OpenAI();
14
15// In-memory storage for demo (in production, use SQLite)
179
180 try {
181 const completion = await openai.chat.completions.create({
182 messages: [
183 { role: "system", content: systemPrompt },
218
219 } catch (error) {
220 console.error('OpenAI API error:', error);
221 return c.json({ error: "Failed to generate response" }, 500);
222 }

StorytellingREADME.md2 matches

@OnesideddimpleUpdated 3 months ago
8- **Poetry Generator**: Generates poems in various styles (haiku, sonnet, free verse, limerick)
9- **Customizable Inputs**: Users can specify genres, moods, themes, and other creative elements
10- **AI-Powered**: Uses OpenAI to generate high-quality, creative content
11- **Clean Interface**: Simple, writer-friendly design focused on the content
12
40## Environment Variables
41
42- `OPENAI_API_KEY` - Required for AI content generation

untitled-5321README.md1 match

@LyteUpdated 3 months ago
35## Environment Variables
36
37- `OPENAI_API_KEY` - Required for OpenAI API access (automatically configured in Val Town)
38
39## Usage

untitled-5321index.ts5 matches

@LyteUpdated 3 months ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { ChatRequest, ChatResponse, ImageGenerationRequest, ImageGenerationResponse } from "../shared/types.ts";
11});
12
13const openai = new OpenAI();
14
15// Serve static files
63 });
64
65 const completion = await openai.chat.completions.create({
66 model: "gpt-4o-mini",
67 messages: messages,
100 }
101
102 const response = await openai.images.generate({
103 model: "dall-e-3",
104 prompt: body.prompt,
111
112 if (!imageUrl) {
113 throw new Error("No image URL returned from OpenAI");
114 }
115

TLDRREADME.md5 matches

@KymmsyUpdated 3 months ago
1# TLDR This - Article Summarizer
2
3A simple web application that summarizes articles and URLs into 1-3 sentence summaries using OpenAI's API.
4
5## Features
6
7- **Simple Interface**: Clean textarea for pasting URLs or article text
8- **Smart Summarization**: Uses OpenAI API to generate concise 1-3 sentence summaries
9- **URL Support**: Automatically fetches and summarizes content from URLs
10- **Error Handling**: Graceful handling of invalid URLs, API failures, and other errors
31## Setup Instructions
32
331. **Environment Variables**: Set up your OpenAI API key in Val Town environment variables:
34 - Go to your Val Town settings
35 - Add environment variable: `OPENAI_API_KEY` with your OpenAI API key
36
372. **Deploy**: The app will automatically deploy when you save the files in Val Town
59The app handles various error scenarios:
60- Invalid or unreachable URLs
61- OpenAI API failures or rate limits
62- Network connectivity issues
63- Malformed input data

TLDRindex.ts5 matches

@KymmsyUpdated 3 months ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { SummarizeRequest, SummarizeResponse, ArticleContent } from "/shared/types.ts";
11});
12
13// Initialize OpenAI
14const openai = new OpenAI();
15
16// Serve frontend files
99}
100
101// Generate summary using OpenAI
102async function generateSummary(content: string, title?: string): Promise<string> {
103 try {
106 : `Please summarize the following text in 1-3 clear, concise sentences:\n\n${content}`;
107
108 const completion = await openai.chat.completions.create({
109 messages: [
110 {

TLDRApp.tsx1 match

@KymmsyUpdated 3 months ago
215 <div className="text-center mt-8 text-white/60 text-sm">
216 <p>
217 Powered by OpenAI • Built with ❤️ on Val Town
218 </p>
219 </div>

AlxprojectREADME.md2 matches

@Bioluwatife_elusakinUpdated 3 months ago
14```
15├── backend/
16│ └── index.ts # Main API server with OpenAI integration
17├── frontend/
18│ ├── index.html # Main application interface
33## Technology Stack
34
35- **Backend**: Hono + OpenAI API
36- **Frontend**: React + TailwindCSS
37- **AI**: GPT-4o-mini for concept explanations

Alxprojectindex.ts5 matches

@Bioluwatife_elusakinUpdated 3 months ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
4import type { ConceptRequest, ConceptResponse, ErrorResponse } from "../shared/types.ts";
11});
12
13const openai = new OpenAI();
14
15// Serve static files
64Return only valid JSON without any markdown formatting.`;
65
66 const completion = await openai.chat.completions.create({
67 messages: [{ role: "user", content: prompt }],
68 model: "gpt-4o-mini",
73 const responseText = completion.choices[0]?.message?.content;
74 if (!responseText) {
75 throw new Error("No response from OpenAI");
76 }
77
81 conceptResponse = JSON.parse(responseText);
82 } catch (parseError) {
83 console.error("Failed to parse OpenAI response:", responseText);
84 throw new Error("Invalid response format from AI");
85 }

TLDRREADME.md3 matches

@KymmsyUpdated 3 months ago
6
7- **URL Content Extraction**: Fetches and parses HTML content from URLs
8- **Text Summarization**: Uses OpenAI API to generate concise summaries
9- **Error Handling**: Comprehensive error handling for various failure scenarios
10- **Static File Serving**: Serves frontend assets and shared utilities
56## Environment Variables
57
58- `OPENAI_API_KEY` - Required for AI summarization
59
60## Error Handling
62The API handles various error scenarios:
63- Invalid URLs or unreachable content
64- OpenAI API failures
65- Malformed requests
66- Content too short to summarize

openai-usage1 file match

@nbbaierUpdated 17 hours ago

hello-realtime5 file matches

@jubertioaiUpdated 3 days ago
Sample app for the OpenAI Realtime API
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