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/$1?q=openai&page=5&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 2470 results for "openai"(5037ms)

openaiproxyREADME.md3 matches

@wangqiao1234•Updated 1 day ago
1# OpenAI Proxy
2
3This OpenAI API proxy injects Val Town's API keys. For usage documentation, check out https://www.val.town/v/std/openai
4
5Migrated from folder: openai/openaiproxy

openaiproxymain.tsx8 matches

@wangqiao1234•Updated 1 day 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 = [
43
44 // Proxy the request
45 const url = new URL("." + pathname, "https://api.openai.com");
46 url.search = search;
47
48 const headers = new Headers(req.headers);
49 headers.set("Host", url.hostname);
50 headers.set("Authorization", `Bearer ${Deno.env.get("OPENAI_API_KEY")}`);
51 headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
52
53 const modifiedBody = await limitFreeModel(req, user);
64 });
65
66 const openAIRes = await fetch(url, {
67 method: req.method,
68 headers,
72
73 // Remove internal header
74 const res = new Response(openAIRes.body, openAIRes);
75 res.headers.delete("openai-organization");
76 return res;
77}

untitled-9814main.tsx3 matches

@join•Updated 1 day ago
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3
4const AI_PROMPT_STYLE_GUIDE =
211 if (req.method === "POST") {
212 try {
213 const openai = new OpenAI();
214 const { prompt } = await req.json();
215
216 const stream = await openai.chat.completions.create({
217 model: "gpt-4o",
218 messages: [

ideasmain.tsx4 matches

@join•Updated 2 days ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { Hono } from "npm:hono@4.4.12";
3
24app.post("/ai", async (c) => {
25 try {
26 const openai = new OpenAI();
27 const body = await c.req.json();
28
29 if (body.action === "getIdeas") {
30 const completion = await openai.chat.completions.create({
31 model: "gpt-4o",
32 messages: [
40
41 if (body.action === "explainIdea") {
42 const completion = await openai.chat.completions.create({
43 model: "gpt-4o-mini",
44 messages: [

formalforgemain.tsx7 matches

@join•Updated 2 days ago
1// @ts-ignore
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3
4// --- AI BEHAVIORAL GUIDELINES & PROMPTS ---
491 const url = new URL(req.url.endsWith("/") ? req.url : req.url + "/");
492 const action = url.searchParams.get("action");
493 const openai = new OpenAI();
494
495 if (req.method !== "POST") {
509
510 // Stage 1: Analyze Input
511 const analysisCompletion = await openai.chat.completions.create({
512 model: "gpt-4o",
513 messages: [{ role: "system", content: PROMPT_ANALYZE }, { role: "user", content: userContext }],
520 JSON.stringify(structuredOutline)
521 }\n---\nRecipient Address:\n${userInput.recipient}\n---\nSender Address:\n${userInput.sender}`;
522 const composeCompletion = await openai.chat.completions.create({
523 model: "gpt-4o",
524 messages: [{ role: "system", content: PROMPT_COMPOSE }, { role: "user", content: composeUserMessage }],
528
529 // Stage 3: Internal Critique of Pre-Draft
530 const firstReviewCompletion = await openai.chat.completions.create({
531 model: "gpt-4o",
532 messages: [{ role: "system", content: PROMPT_REDTEAM_REVIEW }, { role: "user", content: preDraftText }],
539 JSON.stringify(firstCritique)
540 }`;
541 const revisionCompletion = await openai.chat.completions.create({
542 model: "gpt-4o",
543 messages: [{ role: "system", content: PROMPT_REVISE }, { role: "user", content: revisionUserMessage }],
547
548 // Stage 5: Final Critique of Revised Draft
549 const finalReviewCompletion = await openai.chat.completions.create({
550 model: "gpt-4o",
551 messages: [{ role: "system", content: PROMPT_REDTEAM_REVIEW }, { role: "user", content: revisedLetterText }],

github-apiknowledge.md4 matches

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

ProposalHandler.cursorrules4 matches

@lightweight•Updated 2 days ago
94Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
95
96### OpenAI
97
98```ts
99import { OpenAI } from "https://esm.town/v/std/openai";
100const openai = new OpenAI();
101const completion = await openai.chat.completions.create({
102 messages: [
103 { role: "user", content: "Say hello in a creative way" },
166Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
167
168### OpenAI
169
170```ts
171import { OpenAI } from "https://esm.town/v/std/openai";
172const openai = new OpenAI();
173const completion = await openai.chat.completions.create({
174 messages: [
175 { role: "user", content: "Say hello in a creative way" },

github-apillm4 matches

@cricks_unmixed4u•Updated 2 days ago
166Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
167
168### OpenAI
169
170```ts
171import { OpenAI } from "https://esm.town/v/std/openai";
172const openai = new OpenAI();
173const completion = await openai.chat.completions.create({
174 messages: [
175 { role: "user", content: "Say hello in a creative way" },

gissue-rolodexknowledge.md4 matches

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

openai2 file matches

@wangqiao1234•Updated 1 day ago

openaiproxy2 file matches

@wangqiao1234•Updated 1 day ago
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai"; import { sqlite } from "https://esm.town/v/stevekrouse/sqlite"; /** * Practical Implementation of Collective Content Intelligence * Bridging advanced AI with collaborative content creation */ exp
kwhinnery_openai