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/$%7Burl%7D?q=openai&page=50&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 1632 results for "openai"(577ms)

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 {

rousingBronzeMandrillmain.tsx4 matches

@Learn•Updated 1 month ago
112
113 try {
114 const { OpenAI } = await import("https://esm.town/v/std/openai");
115 const openai = new OpenAI();
116
117 const parseResponse = await openai.chat.completions.create({
118 messages: [{
119 role: "system",
128
129 const parsedQuery = parseResponse.choices[0].message.content || '';
130 Logger.log('OpenAI parsed query', { parsedQuery });
131
132 const [rootNode, context] = parsedQuery.split('|').map(s => s.trim());

EchoPromptermain.tsx9 matches

@Learn•Updated 1 month ago
936if (typeof document !== "undefined") { client(); }
937export default async function server(request: Request): Promise<Response> {
938 const { OpenAI } = await import("https://esm.town/v/std/openai");
939 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
940 const openai = new OpenAI();
941
942 // Use the val's URL as a unique key for database tables
1039 const echoPrompt = getEchoPrompt();
1040
1041 const completion = await openai.chat.completions.create({
1042 messages: [
1043 {
1095
1096 // First, generate the agent prompt
1097 const completion2 = await openai.chat.completions.create({
1098 messages: [
1099 {
1121
1122 // Then, generate commands for the agent based on its purpose and description
1123 const commandsCompletion = await openai.chat.completions.create({
1124 messages: [
1125 {
1227 }
1228
1229 // Format the history into OpenAI message format
1230 const messages = [
1231 {
1237 // Add conversation history if it exists
1238 if (history && history.length > 0) {
1239 // Filter out system messages and map to OpenAI format
1240 history.forEach(msg => {
1241 if (msg.role !== "system") {
1255
1256 // Chat with the agent using the stored prompt and history
1257 const completion = await openai.chat.completions.create({
1258 messages: messages,
1259 model: "gpt-4o-mini",
1374
1375 // Execute the command with the AI
1376 const completion = await openai.chat.completions.create({
1377 messages: messages,
1378 model: "gpt-4o-mini",

groqAudioChattts.ts1 match

@dcm31•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: {

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 6 days 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": "*",