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=47&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 1605 results for "openai"(804ms)

homerepairmain.tsx14 matches

@Learn•Updated 1 month ago
529
530export default async function server(request: Request): Promise<Response> {
531 const { OpenAI } = await import("https://esm.town/v/std/openai");
532 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
533 const openai = new OpenAI();
534 const KEY = "homerepair";
535
560 const { agentId, command, inputs } = await request.json();
561
562 // Simulate command execution with OpenAI
563 const messages = [
564 {
572
573 try {
574 const completion = await openai.chat.completions.create({
575 messages: messages,
576 model: "gpt-4o-mini",
588 headers: { "Content-Type": "application/json" },
589 });
590 } catch (openAIError) {
591 console.error("OpenAI API Error:", {
592 message: openAIError.message,
593 name: openAIError.name,
594 stack: openAIError.stack,
595 response: openAIError.response
596 ? await openAIError.response.text()
597 : "No response body",
598 });
600 return new Response(
601 JSON.stringify({
602 error: "OpenAI API Error",
603 details: openAIError.message,
604 stackTrace: openAIError.stack,
605 }),
606 {
4
5import { email } from "https://esm.town/v/std/email";
6import { OpenAI } from "https://esm.town/v/std/openai";
7import { Project, EmailSubscriber } from "../shared/types.ts";
8import { logger } from "./utils.ts";
9
10const openai = new OpenAI();
11
12/**
44
45 try {
46 // Generate welcome email content using OpenAI
47 const prompt = `
48 You are writing a personalized welcome email to someone who just subscribed to "${project.name}".
59 `;
60
61 const completion = await openai.chat.completions.create({
62 messages: [
63 { role: "system", content: "You are a helpful assistant that writes excellent, personalized emails." },

IFSCCodeLookupmain.tsx3 matches

@Emailscompelling•Updated 1 month ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function(
13 additionalContext = "Focus on actionable, practical keyword strategies",
14) {
15 const openai = new OpenAI();
16
17 try {
39 Format the response as a structured JSON object.`;
40
41 const response = await openai.chat.completions.create({
42 model: "gpt-4o-mini",
43 response_format: { type: "json_object" },

groqAudioChattts.ts1 match

@arfan•Updated 1 month ago
26 console.log("🔊 Sending request to Groq Speech API");
27 const start = Date.now();
28 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
29 method: "POST",
30 headers: {

groqAudioChatchat.ts1 match

@arfan•Updated 1 month ago
20 console.log("🔵 Sending request to Groq API");
21 const start = Date.now();
22 const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
23 method: "POST",
24 headers: {

groqAudioChataudio.ts1 match

@arfan•Updated 1 month ago
63 console.log("🎤 Sending request to Groq Whisper API");
64 const start = Date.now();
65 const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", {
66 method: "POST",
67 headers: {

groqAudioChat_migratedmain.tsx3 matches

@arfan•Updated 1 month ago
68 console.log("🎤 Sending request to Groq Whisper API");
69 const start = Date.now();
70 const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", {
71 method: "POST",
72 headers: {
158 console.log("🔵 Sending request to Groq API");
159 const start = Date.now();
160 const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
161 method: "POST",
162 headers: {
214 console.log("🔊 Sending request to Groq Speech API");
215 const start = Date.now();
216 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
217 method: "POST",
218 headers: {

equitableMaroonCrabmain.tsx3 matches

@Emailscompelling•Updated 1 month ago
1export default async function (e: Email) {
2 const { OpenAI } = await import("https://esm.town/v/std/openai");
3 const openai = new OpenAI();
4
5 const skinkDescription = await openai.chat.completions.create({
6 messages: [
7 {

OpenTowniesystem_prompt.txt4 matches

@jxnblk•Updated 1 month ago
137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138
139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144 messages: [
145 { role: "user", content: "Say hello in a creative way" },

confidentWhiteOxmain.tsx3 matches

@ynonp•Updated 1 month ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const openai = new OpenAI();
4
5const completion = await openai.chat.completions.create({
6 messages: [
7 {

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 2 days ago

testOpenAI1 file match

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