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//%22$%7Bconfig.siteUrl%7D/%22?q=api&page=4&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 25400 results for "api"(4256ms)

blob_adminmain.tsx1 match

@danfishgold•Updated 13 hours ago
20// For backwards-compatibility with the old blob-admin
21// TODO - test that more
22app.get("/api/public/:key", (c) => {
23 return blob.get("__public/" + c.req.param("key"));
24});

blob_adminREADME.md1 match

@danfishgold•Updated 13 hours ago
12[![](https://stevekrouse-button.web.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
13
14It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
15
16# TODO
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>NVIDIA API Client</title>
8 <style>
9 body {
121 }
122
123 .api-key-group {
124 background: #fff3cd;
125 border: 1px solid #ffeaa7;
129 }
130
131 .api-key-group label {
132 color: #856404;
133 }
137 <div class="container">
138 <div class="form-panel">
139 <h1>NVIDIA API Client</h1>
140
141 <form id="apiForm">
142 <div class="api-key-group">
143 <div class="form-group">
144 <label for="apiKey">API Key:</label>
145 <input type="password" id="apiKey" name="apiKey" placeholder="Enter your NVIDIA API key">
146 </div>
147 </div>
205 <h2>Response</h2>
206 <div id="responseContent" class="response-content">
207 Click "Send Request" to see the API response here.
208 </div>
209 </div>
231 // Load saved values
232 function loadSavedValues() {
233 // Load API key from cookie
234 const savedApiKey = getCookie('nvidia_api_key');
235 if (savedApiKey) {
236 document.getElementById('apiKey').value = savedApiKey;
237 }
238
262 // Save current form values
263 function saveCurrentValues() {
264 const form = document.getElementById('apiForm');
265 const formData = new FormData(form);
266 const params = {};
267
268 // Save API key to cookie
269 const apiKey = formData.get('apiKey');
270 if (apiKey) {
271 setCookie('nvidia_api_key', apiKey);
272 }
273
274 // Save other parameters to localStorage
275 for (const [key, value] of formData.entries()) {
276 if (key !== 'apiKey') {
277 if (key === 'messages') {
278 try {
297 }
298
299 // Make API request
300 async function makeApiRequest(requestData, apiKey) {
301 const response = await fetch('https://integrate.api.nvidia.com/v1/chat/completions', {
302 method: 'POST',
303 headers: {
304 'Authorization': \`Bearer \${apiKey}\`,
305 'Accept': 'application/json',
306 'Content-Type': 'application/json'
366
367 // Form submission handler
368 document.getElementById('apiForm').addEventListener('submit', async (e) => {
369 e.preventDefault();
370
383 // Get form data
384 const formData = new FormData(e.target);
385 const apiKey = formData.get('apiKey');
386
387 if (!apiKey) {
388 throw new Error('API Key is required');
389 }
390
405 saveCurrentValues();
406
407 // Make API request
408 const response = await makeApiRequest(requestData, apiKey);
409
410 // Handle response based on streaming

untitled-7971main.ts1 match

@ashket3•Updated 15 hours ago
1// Learn more: https://docs.val.town/vals/http/
2const BASE_URL = "https://api.longcat.chat/openai";
3
4export default async function (req: Request): Promise<Response> {
mcp-registry

mcp-registrymain.tsx11 matches

@cameronpak•Updated 16 hours ago
421 </div>
422 <p style="text-align: start; text-wrap: balance; max-width: 65ch;">
423 An open catalog and API for publicly available MCP servers to improve
424 discoverability and implementation. This is{" "}
425 <a href="https://www.val.town/x/cameronpak/mcp-registry">
427 </a>{" "}
428 and also serves as a proxy server for the{" "}
429 <a href="/docs" target="_blank">MCP Registry API</a>
430 </p>
431 <wa-button
478 <wa-callout variant="neutral">
479 <wa-icon slot="icon" name="gear"></wa-icon>
480 <strong>The MCP Registry API is down</strong>
481 <br />
482 I am really sorry about the downtime and will improve caching when the
483 official MCP Registry's API resumes. Check back in later.
484 </wa-callout>
485 <p style="margin-top: 1rem;">
486 I imagine the registry API was either spammed or couldn't scale fast
487 enough. Not sure and I cannot speak on behalf of MCP. Please pray for
488 those working to bring it back up.
520);
521
522// Main route with full API support
523app.get("/", async (c) => {
524 try {
525 const cursor = c.req.query("cursor");
526 const limit = parseInt(c.req.query("limit") || "30"); // API default is 30
527 const search = c.req.query("search");
528 const updatedSince = c.req.query("updated_since");
530 const type = c.req.query("type");
531
532 // Build query parameters according to API spec
533 const queryParams: any = {
534 limit: Math.min(Math.max(limit, 1), 100), // API requires: ≥1 ≤100
535 };
536
597});
598
599// API route for server details (JSON)
600app.get("/api/servers/:id", async (c) => {
601 try {
602 const serverId = c.req.param("id");

Letterboxd_Blueskymain.ts3 matches

@Petezarustica•Updated 16 hours ago
6
7import Parser from "https://esm.sh/rss-parser@3.13.0";
8import { BskyAgent } from "https://esm.sh/@atproto/api@0.13.17";
9
10const RSS_URL = "https://letterboxd.com/petezarustica/rss/";
56 // 4) Deduplicate by checking your recent posts for the same link
57 // (avoids needing KV on Val Town)
58 const feedResp = await agent.api.app.bsky.feed.getAuthorFeed({
59 actor: did,
60 limit: 30,
77 };
78
79 await agent.api.com.atproto.repo.createRecord({
80 repo: did,
81 collection: "app.bsky.feed.post",

NowPlayingGrabbermain.tsx2 matches

@yaoge•Updated 18 hours ago
2import querystring from "npm:querystring";
3
4const NOW_PLAYING_ENDPOINT = "https://api.spotify.com/v1/me/player/currently-playing";
5const TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token";
6
7const client_id = Deno.env.get("spotify_client_id");

cronemain.ts1 match

@jrmann100•Updated 20 hours ago
29 c.redirect(`https://discord.com/oauth2/authorize?client_id=${CLIENT_ID}`)
30);
31app.post("/api/interactions", verify, handleInteraction);
32
33export default app.fetch;

GLM-4-5-Omnimain.tsx12 matches

@aibotcommander•Updated 20 hours ago
24 provider: "groq",
25 model: "meta-llama/llama-4-maverick-17b-128e-instruct",
26 endpoint: "https://api.groq.com/openai/v1/chat/completions",
27 headers: {
28 "Authorization": `Bearer ${process.env.GROQ_API_KEY}`,
29 "Content-Type": "application/json",
30 },
35 provider: "groq",
36 model: "meta-llama/llama-4-scout-17b-16e-instruct",
37 endpoint: "https://api.groq.com/openai/v1/chat/completions",
38 headers: {
39 "Authorization": `Bearer ${process.env.GROQ_API_KEY}`,
40 "Content-Type": "application/json",
41 },
46 provider: "openrouter",
47 model: "deepseek/deepseek-r1-distill-llama-70b",
48 endpoint: "https://openrouter.ai/api/v1/chat/completions",
49 headers: {
50 "Authorization": `Bearer ${process.env.OPEN_ROUTER_API_KEY}`,
51 "Content-Type": "application/json",
52 "HTTP-Referer": process.env.HTTP_REFERER || "https://localhost:3000",
58 provider: "deepseek",
59 model: "deepseek-chat",
60 endpoint: "https://api.deepseek.com/v1/chat/completions",
61 headers: {
62 "Authorization": `Bearer ${process.env.DEEPSEEK_API_KEY}`,
63 "Content-Type": "application/json",
64 },
602
603 for (const config of modelsToTry) {
604 const apiKey = process.env[`${config.provider.toUpperCase()}_API_KEY`] ||
605 process
606 .env[
607 `${
608 config.provider.replace("openrouter", "OPEN_ROUTER").toUpperCase()
609 }_API_KEY`
610 ];
611 if (!apiKey) continue;
612
613 try {
634 send("error", {
635 text:
636 "All configured models failed. Please check your API keys and try again.",
637 allow_retry: true,
638 });

untitled-7197main.ts15 matches

@sammy•Updated 20 hours ago
8
9 try {
10 // 1. Get the Vapi request body
11 const body = await req.json();
12
15 if (!toolCall) {
16 return new Response(
17 JSON.stringify({ error: "Invalid Vapi tool call format" }),
18 { status: 400 },
19 );
31 }
32
33 // 3. Get the Bing API Key from environment secrets
34 const BING_API_KEY = Deno.env.get("BING_API_KEY");
35 if (!BING_API_KEY) {
36 console.error("BING_API_KEY secret is not set.");
37 return new Response(
38 JSON.stringify({
39 error: "Server configuration error: Missing API key.",
40 }),
41 { status: 500 },
43 }
44
45 // 4. Construct the search query and call the Bing API
46 const searchQuery = `${businessName} ${location}`;
47 const bingUrl = `https://api.bing.microsoft.com/v7.0/search?q=${
48 encodeURIComponent(searchQuery)
49 }&count=3`;
50
51 const bingResponse = await fetch(bingUrl, {
52 headers: { "Ocp-Apim-Subscription-Key": BING_API_KEY },
53 });
54
55 if (!bingResponse.ok) {
56 throw new Error(
57 `Bing API request failed with status: ${bingResponse.status}`,
58 );
59 }
69 }
70
71 // 6. Send the formatted result back to Vapi
72 const vapiResponse = {
73 results: [{
74 toolCallId: toolCallId,
77 };
78
79 return new Response(JSON.stringify(vapiResponse), {
80 headers: { "Content-Type": "application/json" },
81 status: 200,
82 });
83 } catch (error) {
84 console.error("Error in Vapi tool handler:", error);
85 return new Response(
86 JSON.stringify({ error: "An internal server error occurred." }),

PixelPixelApiMonitor1 file match

@selfire1•Updated 4 hours ago
Regularly polls the API and messages on an error.

weatherApp1 file match

@dcm31•Updated 10 hours ago
A simple weather app with dropdown cities using Open-Meteo API
fapian
<("<) <(")> (>")>
Kapil01