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=20&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 1580 results for "openai"(1378ms)

stevensDemo.cursorrules4 matches

@donncha•Updated 2 weeks ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

stevensDemo.cursorrules4 matches

@ewancameron•Updated 2 weeks ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

live_pricesmain.tsx3 matches

@danju4rizzl•Updated 2 weeks ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3// Helper function to fetch exchange rates
24
25 // Prepare context for AI analysis
26 const openai = new OpenAI();
27 const analysisPrompt = `
28 Analyze the following economic context:
41
42 // Get AI-powered investment insights
43 const investmentAnalysis = await openai.chat.completions.create({
44 model: "gpt-4o-mini",
45 messages: [{ role: "user", content: analysisPrompt }],

groqAudioChatgroqAudioChat3 matches

@pierremenard•Updated 2 weeks 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: {
216 console.log("🔊 Sending request to Groq Speech API");
217 const start = Date.now();
218 const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
219 method: "POST",
220 headers: {

groqAudioChattts.ts1 match

@pierremenard•Updated 2 weeks 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

@pierremenard•Updated 2 weeks 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

@pierremenard•Updated 2 weeks 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: {

recallone.cursorrules4 matches

@nom•Updated 2 weeks ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

stevensDemo.cursorrules4 matches

@velebanet•Updated 2 weeks ago
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101
102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107 messages: [
108 { role: "user", content: "Say hello in a creative way" },

gptToolsabstractClass8 matches

@nbbaier•Updated 2 weeks ago
1import OpenAI, { type ClientOptions } from "npm:openai";
2
3export interface WriterOptions extends ClientOptions {
7export abstract class AbstractWriter {
8 model: string;
9 openai: OpenAI;
10
11 constructor(options: WriterOptions) {
12 const { model, ...openaiOptions } = options;
13
14 this.model = model ? model : "gpt-3.5-turbo";
15 this.openai = new OpenAI(openaiOptions);
16 }
17
18 protected abstract createPrompt(...args: any[]): string;
19
20 protected async performOpenAICall(prompt: string) {
21 try {
22 const response = await this.openai.chat.completions.create({
23 messages: [{ role: "system", content: prompt }],
24 model: this.model,
26
27 if (!response.choices || response.choices.length === 0) {
28 throw new Error("No response from OpenAI");
29 }
30
32
33 if (!output) {
34 throw new Error("No output returned by OpenAI. Try again.");
35 }
36

testOpenAI1 file match

@stevekrouse•Updated 1 day ago

testOpenAI1 file match

@shouser•Updated 3 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": "*",