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/$%7Bsuccess?q=openai&page=48&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 1606 results for "openai"(830ms)

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: {

groqAudioChatchat.ts1 match

@dcm31โ€ข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

@dcm31โ€ข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: {

extractRecipeAImain.tsx3 matches

@Skeyeโ€ขUpdated 1 month ago
198
199 app.post("/extract-recipe", async (c) => {
200 const { OpenAI } = await import("https://esm.town/v/std/openai");
201 const openai = new OpenAI();
202
203 const formData = await c.req.formData();
224
225 try {
226 const response = await openai.chat.completions.create({
227 model: "gpt-4o",
228 messages: [

chatGPTClonemain.tsx4 matches

@Bam031272โ€ขUpdated 1 month ago
124 if (request.method === 'POST' && new URL(request.url).pathname === '/chat') {
125 try {
126 const { OpenAI } = await import("https://esm.town/v/std/openai");
127 const openai = new OpenAI();
128
129 const body = await request.json();
130 const completion = await openai.chat.completions.create({
131 messages: body.messages.map((msg: Message) => ({
132 role: msg.role,
143 });
144 } catch (error) {
145 console.error('OpenAI Error:', error);
146 return new Response(JSON.stringify({
147 message: 'Sorry, I encountered an error processing your request.'

gentleRoseGalliformmain.tsx3 matches

@dcm31โ€ขUpdated 1 month ago
67 console.log("๐ŸŽค Sending request to Groq Whisper API");
68 const start = Date.now();
69 const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", {
70 method: "POST",
71 headers: {
157 console.log("๐Ÿ”ต Sending request to Groq API");
158 const start = Date.now();
159 const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
160 method: "POST",
161 headers: {
213 console.log("๐Ÿ”Š Sending request to Groq Speech API");
214 const start = Date.now();
215 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
216 method: "POST",
217 headers: {

groqAudioChatgroqAudioChat3 matches

@dcm31โ€ข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: {

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": "*",