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=77&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 1679 results for "openai"(806ms)

mathOfTheDayaccomplishedOrangePenguin3 matches

@charmaine•Updated 2 months ago
189
190export default async function server(request) {
191 const { OpenAI } = await import("https://esm.town/v/std/openai");
192 const { blob } = await import("https://esm.town/v/std/blob");
193 const url = new URL(request.url);
194
195 if (url.pathname === "/problem") {
196 const openai = new OpenAI();
197 const completion = await openai.chat.completions.create({
198 model: "gpt-4",
199 messages: [

chatAgentWithCustomPromptmain.tsx3 matches

@mjoshimanhar•Updated 2 months ago
1import { initializeAgentExecutorWithOptions } from "https://esm.sh/langchain/agents";
2import { ChatOpenAI } from "https://esm.sh/langchain/chat_models/openai";
3import { Calculator } from "https://esm.sh/langchain/tools/calculator";
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6export default async function chatAgentWithCustomPrompt(input?: string) {
7 const model = new ChatOpenAI({
8 temperature: 0,
9 });

diverseAmberReindeerREADME.md1 match

@melissanf•Updated 2 months ago
25## **Tech Stack**
26- **Townie AI** – AI-based automation
27- **OpenAI API** – For generating blog content
28- **Built-in Databases** – To store and retrieve topics (if needed)
29

blogIdeaGeneratorAppmain.tsx4 matches

@melissanf•Updated 2 months ago
276 // Handle API and shared content routes
277 if (request.method === "POST") {
278 const { OpenAI } = await import("https://esm.town/v/std/openai");
279 const { blob } = await import("https://esm.town/v/std/blob");
280 const openai = new OpenAI();
281
282 const { topic, idea, type } = await request.json();
293 let response;
294 if (type === "ideas") {
295 response = await openai.chat.completions.create({
296 messages: [
297 {
317 });
318 } else if (type === "outline") {
319 response = await openai.chat.completions.create({
320 messages: [
321 {

blogIdeaGeneratorAppREADME.md1 match

@melissanf•Updated 2 months ago
15### Tech Stack
16* Townie AI – AI-based automation
17* OpenAI API – For generating blog content
18* Built-in Databases – To store and retrieve topics (if needed)
19* How to Deploy & Share

productiveIndigoJayREADME.md1 match

@melissanf•Updated 2 months ago
25## **Tech Stack**
26- **Townie AI** – AI-based automation
27- **OpenAI API** – For generating blog content
28- **Built-in Databases** – To store and retrieve topics (if needed)
29

shoppingPlatformAImain.tsx3 matches

@Priyansh•Updated 2 months ago
59 async function generateAIRecommendations() {
60 try {
61 const { OpenAI } = await import("https://esm.town/v/std/openai");
62 const openai = new OpenAI();
63
64 const recommendations = await openai.chat.completions.create({
65 messages: [
66 {

priyanshCartoonAppmain.tsx4 matches

@Priyansh•Updated 2 months ago
71 async function generateAIDescription() {
72 try {
73 const { OpenAI } = await import("https://esm.town/v/std/openai");
74 const openai = new OpenAI();
75
76 const aiVideoCompletion = await openai.chat.completions.create({
77 messages: [
78 {
85 });
86
87 const aiDescription = await openai.chat.completions.create({
88 messages: [
89 {

aiVideoAppmain.tsx4 matches

@Priyansh•Updated 2 months ago
242
243export default async function server(request: Request): Promise<Response> {
244 const { OpenAI } = await import("https://esm.town/v/std/openai");
245 const openai = new OpenAI();
246
247 const url = new URL(request.url);
254 try {
255 // Simulated video analysis (in a real scenario, you'd use a more advanced video processing service)
256 const analysisResponse = await openai.chat.completions.create({
257 messages: [
258 {
288 try {
289 // Generate video concept
290 const conceptResponse = await openai.chat.completions.create({
291 messages: [
292 {

priyanshSocialMediaAppmain.tsx5 matches

@Priyansh•Updated 2 months ago
201export default async function server(request: Request): Promise<Response> {
202 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
203 const { OpenAI } = await import("https://esm.town/v/std/openai");
204 const KEY = "priyanshSocialMediaApp";
205 const SCHEMA_VERSION = 5;
208
209 const url = new URL(request.url);
210 const openai = new OpenAI();
211
212 // New Vision Analysis Endpoint
222 );
223
224 // Use OpenAI Vision API
225 const visionResponse = await openai.chat.completions.create({
226 model: "gpt-4-vision-preview",
227 messages: [
271 `;
272
273 const textCompletion = await openai.chat.completions.create({
274 messages: [
275 { role: "system", content: "You are a creative content generator for social media templates." },

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 1 week ago

testOpenAI1 file match

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