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=73&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 1616 results for "openai"(765ms)

ai_pricingtypes2 matches

@nbbaier•Updated 2 months ago
22
23export type Provider =
24 | "openai"
25 | "text-completion-openai"
26 | "azure"
27 | "azure_text"

HTKhanAISearchmain.tsx3 matches

@Htkhan6•Updated 2 months ago
384export default async function server(request: Request): Promise<Response> {
385 if (request.method === "POST") {
386 const { OpenAI } = await import("https://esm.town/v/std/openai");
387 const openai = new OpenAI();
388
389 const body = await request.json();
391
392 try {
393 const summaryCompletion = await openai.chat.completions.create({
394 messages: [
395 {

ultimateGraySailfishmain.tsx3 matches

@Htkhan5•Updated 2 months ago
508export default async function server(request: Request): Promise<Response> {
509 if (request.method === 'POST') {
510 const { OpenAI } = await import("https://esm.town/v/std/openai");
511 const openai = new OpenAI();
512
513 const body = await request.json();
530
531 // AI Summary Generation
532 const aiCompletion = await openai.chat.completions.create({
533 messages: [
534 {

ai_pricinggetPricing1 match

@nbbaier•Updated 2 months ago
6const pricing = Object.fromEntries(
7 Object.entries(res).filter(([_, obj]) =>
8 obj.litellm_provider === "text-completion-openai" || obj.litellm_provider === "openai"
9 ),
10);

ai_pricinggetUsage2 matches

@nbbaier•Updated 2 months ago
1import { fetchOpenAiUsageData } from "https://esm.town/v/nbbaier/fetchOpenAiUsageData";
2import { DateTime } from "npm:luxon";
3import { TextData } from "./types";
8const month = date.setZone(timeZone).toFormat("LLLL").toLowerCase();
9
10const { data }: { data: TextData[] } = await fetchOpenAiUsageData(today);
11
12function removeNullValues<T extends Record<string, any>>(obj: T): Partial<T> {

Tanveer_AI_Assistant_Appmain.tsx3 matches

@Tanveer•Updated 2 months ago
88export default async function server(request) {
89 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
90 const { OpenAI } = await import("https://esm.town/v/std/openai");
91 const openai = new OpenAI();
92
93 const { messages } = await request.json();
94
95 try {
96 const completion = await openai.chat.completions.create({
97 messages,
98 model: "gpt-4o-mini",

openAIStreamingExamplemain.tsx3 matches

@maxm•Updated 2 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2export default async function(req: Request): Promise<Response> {
3 const openai = new OpenAI();
4 const stream = await openai.chat.completions.create({
5 stream: true,
6 messages: [{ role: "user", content: "Write a poem in the style of beowulf about the DMV" }],

fastAIAssistantmain.tsx3 matches

@huzaifa527•Updated 2 months ago
231 const { query } = await request.json();
232
233 const { OpenAI } = await import("https://esm.town/v/std/openai");
234 const openai = new OpenAI();
235
236 const controller = new AbortController();
249 async start(controller) {
250 try {
251 const completion = await openai.chat.completions.create({
252 messages: [
253 {

bubblyLimeWildcatmain.tsx5 matches

@Htkhan3•Updated 2 months ago
353export default async function server(request: Request): Promise<Response> {
354 try {
355 const { OpenAI } = await import("https://esm.town/v/std/openai");
356
357 if (request.method === "POST" && new URL(request.url).pathname === "/chat") {
358 const openai = new OpenAI();
359 const { messages } = await request.json();
360
407 }
408
409 // OpenAI query
410 try {
411 const completion = await openai.chat.completions.create({
412 model: "gpt-4o-mini",
413 messages: messages,
423 });
424 } catch (error) {
425 console.error("OpenAI API Error:", error);
426 return new Response("Sorry, something went wrong.", {
427 status: 500,

appChatGPTLitemain.tsx3 matches

@ChatGPTlite•Updated 2 months ago
72export default async function server(request: Request): Promise<Response> {
73 if (request.method === "POST") {
74 const { OpenAI } = await import("https://esm.town/v/std/openai");
75 const openai = new OpenAI();
76
77 try {
78 const { messages } = await request.json();
79 const completion = await openai.chat.completions.create({
80 messages: messages,
81 model: "gpt-4o-mini",

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 4 days ago

testOpenAI1 file match

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