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%22Optional%20title%22?q=api&page=988&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 13058 results for "api"(1198ms)

surfboardDemoSchedule2main.tsx5 matches

@szymonatorUpdated 9 months ago
1// WELCOME TO THE API DEMO
2// Since val.town doesn't behave well, we cannot access the value of inputs after the page has been loaded once.
3// Therefore, the only way to let the user modify their values is to do it manually.
35
36 const data = await fetch(
37 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${start.toISOString()}&end=${end.toISOString()}`,
38 {
39 headers: {
40 // ADD YOUR API TOKEN INTO THE ENV VARIABLES
41 "Authorization": `Bearer ${Deno.env.get("TEAMSURFBOARD_API_TOKEN")}`,
42 },
43 },
138 <div style={styles.container}>
139 <h1>Employee hours and pay</h1>
140 <h3>(This is an API demo to showcase how the Teamsurfboard API can be used.)</h3>
141 <div style={styles.info}>
142 <p style={styles.info_text}>

blobCommentsReactmain.tsx3 matches

@keenanzuckerUpdated 9 months ago
63 tomorrow.setDate(tomorrow.getDate() + 1);
64 const data = await fetch(
65 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
66 {
67 headers: {
68 // ADD YOUR API TOKEN INTO THE ENV VARIABLES
69 "Authorization": `Bearer ${Deno.env.get("TEAMSURFBOARD_API_TOKEN")}`,
70 },
71 },

surfboardDemoSchedule2main.tsx3 matches

@keenanzuckerUpdated 9 months ago
9 tomorrow.setDate(tomorrow.getDate() + 1);
10 const data = await fetch(
11 `https://api.stage.teamsurfboard.com/api/v1/schedule?start=${today.toISOString()}&end=${tomorrow.toISOString()}`,
12 {
13 headers: {
14 // ADD YOUR API TOKEN INTO THE ENV VARIABLES
15 "Authorization": `Bearer ${Deno.env.get("TEAMSURFBOARD_API_TOKEN")}`,
16 },
17 },

telegramWebhookEchoMessagemain.tsx2 matches

@ghsaboiasUpdated 9 months ago
3
4const BOT_TOKEN = Deno.env.get("TELEGRAM_TOKEN");
5const TELEGRAM_API_URL = `https://api.telegram.org/bot${BOT_TOKEN}`;
6
7useHTTP(async (req, res) => {
26async function sendMessage(chatId, text) {
27 try {
28 const url = `${TELEGRAM_API_URL}/sendMessage`;
29 const payload = {
30 chat_id: chatId,

illustratedPrimerREADME.md1 match

@nknjUpdated 9 months ago
1Generates a streaming illustrated primer on a subject. Enter a subject, click on titles to "delve".
2
3🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits

illustratedPrimermain.tsx3 matches

@nknjUpdated 9 months ago
8
9 // Substrate graph
10 const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY_R") });
11 const Topic = z
12 .object({
79
80 // UI
81 const capitalize = s => s.replace(/^\w/, c => c.toUpperCase());
82 return new Response(
83 new ReadableStream({
96 <div style="margin:0 10px;">${pair.image}</div>
97 <div style="margin:0 10px;font-size:1.2rem;">
98 <a href="/?input=${pair.title}"><b>${capitalize(pair.title)}</b></a><br/>${pair.caption}</div>
99</div>`,
100 ));

salmonMolemain.tsx3 matches

@nknjUpdated 9 months ago
4import { zodToJsonSchema } from "npm:zod-to-json-schema";
5
6const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
7
8// search for HN comments using https://hn.algolia.com/api
9const query = "langchain";
10const searchResults = await hnSearch({
31 new ComputeJSON({
32 prompt: `Summarize this comment and how it relates to the topic: ${query}
33 Use "negative" sentiment for posts about API, abstraction, documentation, tutorial, general quality, slowness, or performance issues.
34 COMMENT: ${JSON.stringify(hit)}`,
35 json_schema: zodToJsonSchema(commentInfo),

salmonMoleREADME.md2 matches

@nknjUpdated 9 months ago
1Find comments on HN (powered by [Algolia](https://hn.algolia.com/api)), extract content and return a streaming markdown summary (powered by [Substrate](https://substrate.run)).
2
3The RAG portion of this is 34 lines of Substrate code. Read the walkthrough: https://x.com/vprtwn/status/1812844236401762513
4
5🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits.
6
7See also:

openaiproxyREADME.md1 match

@mmrechUpdated 9 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

@mmrechUpdated 9 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";
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 });
41
42 // Proxy the request
43 const url = new URL("." + pathname, "https://api.openai.com");
44 url.search = search;
45
46 const headers = new Headers(req.headers);
47 headers.set("Host", url.hostname);
48 headers.set("Authorization", `Bearer ${Deno.env.get("OPENAI_API_KEY")}`);
49 headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
50
51 const modifiedBody = await limitFreeModel(req, user);

vapi-minutes-db1 file match

@henrywilliamsUpdated 2 days ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 2 days ago
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
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com