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=87&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 1614 results for "openai"(703ms)

highApricotImpalamain.tsx3 matches

@jdan•Updated 4 months ago
390export default async function server(request: Request): Promise<Response> {
391 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
392 const { OpenAI } = await import("https://esm.town/v/std/openai");
393 const KEY = "highApricotImpala";
394 const SCHEMA_VERSION = 2;
501 );
502
503 const openai = new OpenAI();
504
505 const completion = await openai.chat.completions.create({
506 messages: [
507 {

openaiproxymain.tsx8 matches

@std•Updated 4 months ago
1import { parseBearerString } from "https://esm.town/v/andreterron/parseBearerString";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { OpenAIUsage } from "https://esm.town/v/std/OpenAIUsage";
4import { RateLimit } from "npm:@rlimit/http";
5const client = new OpenAIUsage();
6
7const allowedPathnames = [
42
43 // Proxy the request
44 const url = new URL("." + pathname, "https://api.openai.com");
45 url.search = search;
46
47 const headers = new Headers(req.headers);
48 headers.set("Host", url.hostname);
49 headers.set("Authorization", `Bearer ${Deno.env.get("OPENAI_API_KEY")}`);
50 headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
51
52 const modifiedBody = await limitFreeModel(req, user);
63 });
64
65 const openAIRes = await fetch(url, {
66 method: req.method,
67 headers,
71
72 // Remove internal header
73 const res = new Response(openAIRes.body, openAIRes);
74 res.headers.delete("openai-organization");
75 return res;
76}

emailSummaryHandlermain.tsx3 matches

@gitgrooves•Updated 4 months ago
1import { email } from "https://esm.town/v/std/email";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4
8
9export default async function(e: Email) {
10 const openai = new OpenAI();
11
12 const summary = await openai.chat.completions.create({
13 messages: [
14 {

emailSummaryHandlermain.tsx3 matches

@dazzag24•Updated 4 months ago
1import { email } from "https://esm.town/v/std/email";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4
9export default async function(e: Email) {
10 console.log(e.from, e.subject);
11 const openai = new OpenAI();
12
13 const summary = await openai.chat.completions.create({
14 messages: [
15 {

emailSummaryHandlermain.tsx3 matches

@stevekrouse•Updated 4 months ago
1import { email } from "https://esm.town/v/std/email";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { extractValInfo } from "https://esm.town/v/stevekrouse/extractValInfo";
4
9export default async function(e: Email) {
10 console.log(e.from, e.subject);
11 const openai = new OpenAI();
12
13 const summary = await openai.chat.completions.create({
14 messages: [
15 {

byobREADME.md1 match

@mrshorts•Updated 4 months ago
11
12### Toolings
13* Llms can uses [tools](https://platform.openai.com/docs/guides/function-calling), meaning you can make this an agent and a whole lot more useful.
14
15

byobmain.tsx3 matches

@mrshorts•Updated 4 months ago
1import { zodResponseFormat } from "https://esm.sh/openai/helpers/zod";
2import { z } from "https://esm.sh/zod";
3import { email } from "https://esm.town/v/std/email";
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6export default async function(e: Email) {
7 const client = new OpenAI();
8
9 const Messages = z.object({

spotlessMagentaSilverfishmain.tsx3 matches

@Pushpam•Updated 4 months 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 { role: "user", content: "Say hello in a creative way" },

pythonLearningAppmain.tsx9 matches

@mrshorts•Updated 4 months ago
173 console.log('Parsed topic:', topic);
174
175 // Dynamically import OpenAI with error handling
176 let OpenAI;
177 try {
178 const module = await import("https://esm.town/v/std/openai");
179 OpenAI = module.OpenAI;
180 } catch (importError) {
181 console.error('OpenAI import error:', importError);
182 return new Response(JSON.stringify({
183 error: `Failed to import OpenAI: ${importError.message}`
184 }), {
185 status: 500,
188 }
189
190 // Create OpenAI instance
191 const openai = new OpenAI();
192
193 // Generate explanation
194 const completion = await openai.chat.completions.create({
195 messages: [
196 {

zyloxAIChatAppmain.tsx4 matches

@gigmx•Updated 4 months ago
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4import OpenAI from "https://esm.sh/openai@4.28.4";
5
6function App() {
184export default async function server(request: Request): Promise<Response> {
185 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
186 const { OpenAI } = await import("https://esm.town/v/std/openai");
187 const openai = new OpenAI();
188
189 const { message, characterPrompt } = await request.json();
190
191 const stream = await openai.chat.completions.create({
192 model: "gpt-4o-mini",
193 messages: [

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 3 days ago

testOpenAI1 file match

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