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/...?q=openai&page=37&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 2273 results for "openai"(2130ms)

x402-demoserver.tsx3 matches

@stevedylandev•Updated 2 weeks ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { type Context, Hono } from "npm:hono";
3import { paymentMiddleware } from "npm:x402-hono";
4
5const openai = new OpenAI();
6
7const app = new Hono();
28
29app.get("/jokes", async (c: Context) => {
30 const completion = await openai.chat.completions.create({
31 messages: [
32 { role: "user", content: "Tell a punny programming joke" },

stevensDemo.cursorrules4 matches

@AIVibeCoded•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" },

MCPREADME.md1 match

@c15r•Updated 2 weeks ago
8- **SQLite Database**: Execute queries and manage database operations
9- **Email**: Send emails through Val Town's email service
10- **OpenAI Integration**: Access OpenAI API through Val Town's service
11- **File Operations**: Read and list project files
12- **Environment Variables**: Access environment configuration

MCPREADME.md2 matches

@c15r•Updated 2 weeks ago
40 - `email_send` - Send emails
41
424. **OpenAI**
43 - `openai_chat` - Generate text with OpenAI
44
455. **File Operations**

MCPtools.ts9 matches

@c15r•Updated 2 weeks ago
6import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
7import { email } from "https://esm.town/v/std/email";
8import { OpenAI } from "https://esm.town/v/std/openai";
9import { readFile, listFiles } from "https://esm.town/v/std/utils@85-main/index.ts";
10import { MCPTool, MCPToolResult } from "./types.ts";
85 },
86 {
87 name: "openai_chat",
88 description: "Generate text using OpenAI's chat completion API",
89 inputSchema: {
90 type: "object",
102 }
103 },
104 model: { type: "string", default: "gpt-4o-mini", description: "OpenAI model to use" },
105 max_tokens: { type: "number", description: "Maximum tokens to generate" },
106 temperature: { type: "number", description: "Sampling temperature" }
156 case "email_send":
157 return await handleEmailSend(args);
158 case "openai_chat":
159 return await handleOpenAIChat(args);
160 case "file_read":
161 return await handleFileRead(args);
285}
286
287async function handleOpenAIChat(args: any): Promise<MCPToolResult> {
288 validateRequired(args, ["messages"]);
289
290 const openai = new OpenAI();
291 const options: any = {
292 messages: args.messages,
297 if (args.temperature !== undefined) options.temperature = args.temperature;
298
299 const completion = await openai.chat.completions.create(options);
300
301 return {

tourguideREADME.md1 match

@neverstew•Updated 2 weeks ago
47## Technology Stack
48
49- **Backend**: Hono + SQLite + OpenAI
50- **Frontend**: React + TypeScript + TailwindCSS
51- **Offline**: Service Workers + Cache API
GitHub-PR-Automation

GitHub-PR-AutomationREADME.md2 matches

@charmaine•Updated 2 weeks ago
119
1201. When a new message is posted in a configured Slack channel (ie. #bugs, or #support), Slack sends an event to this Val
1212. The val makes an OpenAI call to determine if the message is a bug
1223. If it is, then it searches GitHub for semantically related open issues with a separate OpenAI call
1234. It posts a comment in the Slack thread with links to related GitHub issues, with a "Relevance Score"
124
6 */
7
8import { OpenAI } from "https://esm.town/v/std/openai";
9import { Octokit } from "https://esm.sh/@octokit/rest@20.0.2";
10import { WebClient } from "https://esm.sh/@slack/web-api@7.0.2";
129async function isBugReportLLM(text: string): Promise<boolean> {
130 try {
131 // Check if OpenAI API key is available
132 if (!Deno.env.get("OPENAI_API_KEY")) {
133 console.warn("OpenAI API key not found - bug detection disabled");
134 return false;
135 }
136
137 const openai = new OpenAI();
138 const completion = await openai.chat.completions.create({
139 messages: [
140 {
249async function findRelatedIssues(slackMessage: string, issues: any[]): Promise<any[]> {
250 try {
251 // Check if OpenAI API key is available
252 if (!Deno.env.get("OPENAI_API_KEY")) {
253 return [];
254 }
271 }).join("\n\n");
272
273 const openai = new OpenAI();
274 const completion = await openai.chat.completions.create({
275 messages: [
276 {

openaiproxyREADME.md3 matches

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

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

openai-client4 file matches

@cricks_unmixed4u•Updated 44 mins ago

openai_enrichment6 file matches

@stevekrouse•Updated 2 weeks ago
kwhinnery_openai
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