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/image-url.jpg%20%22Image%20title%22?q=api&page=75&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 20751 results for "api"(2275ms)

sprint-summarizerclaude-desktop-config.json1 match

@pdw•Updated 1 week ago
5 "args": [
6 "-X", "POST",
7 "https://sprintsummarizer-pdw.web.val.run/api/mcp",
8 "-H", "Content-Type: application/json",
9 "-d", "@-"

sprint-summarizerprAnalytics.http.ts6 matches

@pdw•Updated 1 week ago
13} from "https://val.town/v/pdw/prDatabase";
14
15// Get Gemini API key from environment
16const GEMINI_API_KEY = Deno.env.get("GEMINI_API_KEY") || "";
17
18interface RollupRequest {
29 focus: string = "executive"
30): Promise<string> {
31 if (!GEMINI_API_KEY) {
32 return "AI summary generation unavailable - Gemini API key not configured";
33 }
34
35 const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);
36 const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
37
211}
212
213// Main HTTP handler for analytics API
214export default async function(req: Request): Promise<Response> {
215 const url = new URL(req.url);

sprint-summarizermain.tsx.backup2 matches

@pdw•Updated 1 week ago
70 try {
71 const response = await fetch(
72 `https://api.github.com/repos/${GITHUB_REPO}/actions/workflows/${GITHUB_WORKFLOW_ID}/dispatches`,
73 {
74 method: "POST",
121 } else {
122 const error = await response.text();
123 throw new Error(`GitHub API returned ${response.status}: ${error}`);
124 }
125 } catch (error) {

dante4evermain.tsx2 matches

@cashlessman•Updated 1 week ago
13
14 const data = await response.json();
15 console.log("API Response:", data);
16 } catch (error) {
17 console.error("Error fetching API:", error);
18 }
19}

untitled-3416main.tsx7 matches

@wangqiao1234•Updated 1 week ago
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });

openaiproxyREADME.md1 match

@wangqiao1234•Updated 1 week 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.tsx5 matches

@wangqiao1234•Updated 1 week 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";
27 const authHeader = req.headers.get("Proxy-Authorization") || req.headers.get("Authorization");
28 const token = authHeader ? parseBearerString(authHeader) : undefined;
29 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization: `Bearer ${token}` } });
30 if (!meRes.ok) {
31 return new Response("Unauthorized", { status: 401 });
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);

untitled-2774main.tsx3 matches

@wangqiao1234•Updated 1 week ago
3
4client = OpenAI(
5 api_key=os.environ.get(
6 "OPENAI_API_KEY", "<your OpenAI API key if not set as env var>"
7 )
8)
88"""
89
90PYTHON_TOOL_DESCRIPTION = """This function is used to execute Python code or terminal commands in a stateful Jupyter notebook environment. python will respond with the output of the execution or time out after 60.0 seconds. Internet access for this session is disabled. Do not make external web requests or API calls as they will fail. Just as in a Jupyter notebook, you may also execute terminal commands by calling this function with a terminal command, prefaced with an exclamation mark.
91
92In addition, for the purposes of this task, you can call this function with an `apply_patch` command as input. `apply_patch` effectively allows you to execute a diff/patch against a file, but the format of the diff specification is unique to this task, so pay careful attention to these instructions. To use the `apply_patch` command, you should pass a message of the following structure as "input":

openai144main.tsx7 matches

@wangqiao1234•Updated 1 week ago
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });

openai144README.md3 matches

@wangqiao1234•Updated 1 week ago
1# OpenAI - [Docs ↗](https://docs.val.town/std/openai)
2
3Use OpenAI's chat completion API with [`std/openai`](https://www.val.town/v/std/openai). This integration enables access to OpenAI's language models without needing to acquire API keys.
4
5For free Val Town users, [all calls are sent to `gpt-4o-mini`](https://www.val.town/v/std/openaiproxy?v=12#L85).
65If these limits are too low, let us know! You can also get around the limitation by using your own keys:
66
671. Create your own API key on [OpenAI's website](https://platform.openai.com/api-keys)
682. Create an [environment variable](https://www.val.town/settings/environment-variables?adding=true) named `OPENAI_API_KEY`
693. Use the `OpenAI` client from `npm:openai`:
70

claude-api1 file match

@ziyanwould•Updated 3 days ago

api-workshop

@danarddanielsjr•Updated 4 days ago
replicate
Run AI with an API
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)