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=api&page=798&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 11714 results for "api"(1369ms)

BrowserbaseFetcherFromURLmain.tsx5 matches

@willthereaderUpdated 7 months ago
1import { PuppeteerDeno } from "https://deno.land/x/puppeteer@16.2.0/src/deno/Puppeteer.ts";
2// 1st stable version is v13
3const BROWSERBASE_API_KEY = Deno.env.get("BROWSERBASE_API_KEY");
4const TIMEOUT = 30000; // 30 seconds timeout
5
16 let browser;
17 try {
18 if (!BROWSERBASE_API_KEY) {
19 throw new Error("BROWSERBASE_API_KEY is not set");
20 }
21
22 const puppeteer = new PuppeteerDeno({ productName: "chrome" });
23 const wsEndpoint = `wss://connect.browserbase.com?apiKey=${BROWSERBASE_API_KEY}&enableProxy=true`;
24
25 console.log("Attempting to connect to Browserbase...");
80 let errorMessage = error.message;
81 if (error.message.includes("400 Bad Request")) {
82 errorMessage = "Failed to connect to Browserbase. Please check your API key and account status.";
83 }
84 return new Response(JSON.stringify({ error: errorMessage }), {

entireGoldLarkmain.tsx1 match

@nlnhsrUpdated 7 months ago
86 if (!inputs.$key || inputs.$key != Deno.env.get("BB_SERVICE_KEY")) {
87 return {
88 $error: "Must provide an API key to access the service.",
89 };
90 }

openaiproxyREADME.md1 match

@roadlabsUpdated 7 months 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

openaiproxymain.tsx5 matches

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

bbaasfemain.tsx1 match

@odichoUpdated 7 months ago
58 * Indicates that the input or output port represents base structured
59 * datatype containing multi-part content of a message, generated by an LLM.
60 * See [Content](https://ai.google.dev/api/rest/v1beta/Content) for details
61 * on the datatype.
62 */

entireGoldLarkmain.tsx1 match

@odichoUpdated 7 months ago
86 if (!inputs.$key || inputs.$key != Deno.env.get("BB_SERVICE_KEY")) {
87 return {
88 $error: "Must provide an API key to access the service.",
89 };
90 }

bbrunmain.tsx1 match

@yejunUpdated 7 months ago
131
132const boardToEndpoint = (board: string) => {
133 return board.replace(/\.json$/, ".api/run");
134};
135

bbrunREADME.md2 matches

@yejunUpdated 7 months ago
4
5For now, requires you to be running a board server. This harness actually acts
6as a proxy to the board server [run API endpoint](https://breadboard-ai.github.io/breadboard/docs/reference/board-run-api-endpoint/),
7and puts a nice (well, somewhat nice) frontend on top of it.
8
11
12The script will look for the `BB_LIVE_KEY` in your Val Town environment, which
13must contain your board server API key.
14
15To use, create an HTTP val, then import the `proxy` function from this script and call it like this:

bbrunREADME.md2 matches

@kenbarrettUpdated 7 months ago
4
5For now, requires you to be running a board server. This harness actually acts
6as a proxy to the board server [run API endpoint](https://breadboard-ai.github.io/breadboard/docs/reference/board-run-api-endpoint/),
7and puts a nice (well, somewhat nice) frontend on top of it.
8
11
12The script will look for the `BB_LIVE_KEY` in your Val Town environment, which
13must contain your board server API key.
14
15To use, create an HTTP val, then import the `proxy` function from this script and call it like this:

cooingTomatoSquirrelmain.tsx1 match

@mrsnorUpdated 7 months ago
68) {
69 return async (req: Request) => {
70 const { api } = await import("https://esm.town/v/pomdtr/api");
71 const { deleteCookie, getCookies, setCookie } = await import("jsr:@std/http/cookie");
72

gpt-image-test

@CaptainJackUpdated 22 mins ago
测试 gpt image 的不同 api 能否满足图片生成要求

new-val-api-21 file match

@shouserUpdated 1 day ago
This is an example of using the API to create a val.
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration