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/$2?q=api&page=10&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 15454 results for "api"(2401ms)

todo-apptypes.ts1 match

@diegoivoβ€’Updated 13 hours ago
36}
37
38export interface ApiResponse<T = any> {
39 success: boolean;
40 data?: T;

eink-frameapod.ts3 matches

@michaelwschultzβ€’Updated 13 hours ago
11};
12
13const NASA_API_KEY = Deno.env.get("NASA_API_KEY");
14
15export default async function GetAPOD(req: Request): Promise<Response> {
16 const url = `https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}&thumbs=true`;
17 const cacheKey = "nasa_apod";
18 const cacheMinutes = 60;
21
22 if (!data) {
23 return new Response("No data from Nasa API", { status: 404 });
24 }
25

eink-framegithub.tsx1 match

@michaelwschultzβ€’Updated 13 hours ago
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server";
4import GetGitHubData, { type GitHubContributionsResponse } from "../api/github.ts";
5import { BodyWrapper, Content, Footer, Header, Headline } from "../components.tsx";
6

eink-framehemolog.tsx1 match

@michaelwschultzβ€’Updated 13 hours ago
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server";
4import GetLogs, { type HEMOLOG_TREATMENT } from "../api/hemolog.ts";
5import { BodyWrapper, Content, Footer, Header, Headline } from "../components.tsx";
6

ChatStreamingChat.tsx15 matches

@c15rβ€’Updated 13 hours ago
47 }));
48
49 const apiMessages = history
50 .filter((m) => m.role !== "system")
51 .map((m) => ({ role: m.role, content: m.content }))
56 max_tokens: 8_000,
57 stream: true,
58 messages: apiMessages,
59 ...(enabledMCP.length && { mcp_servers: enabledMCP }),
60 };
62
63/** Build headers */
64function buildHeaders(apiKey: string, usingMCP: boolean): Record<string, string> {
65 const headers: Record<string, string> = {
66 "x-api-key": apiKey,
67 "anthropic-version": "2023-06-01",
68 "content-type": "application/json",
118 const send = useCallback(
119 async (history: Message[], userText: string): Promise<AssistantMsg> => {
120 if (!config.anthropicApiKey) throw new Error("API key missing");
121 if (status !== "idle") throw new Error("Stream already in progress");
122
125 const body = buildBody(config, history, userText);
126 const headers = buildHeaders(
127 config.anthropicApiKey,
128 (body as any).mcp_servers?.length,
129 );
132 abortRef.current = ctrl;
133
134 const resp = await fetch("https://api.anthropic.com/v1/messages", {
135 method: "POST",
136 body: JSON.stringify(body),
143 throw new Error(
144 err.error?.message
145 ?? `Anthropic API error: ${resp.status} ${resp.statusText}`,
146 );
147 }
273 /** Dispatch user input */
274 const fireSend = async () => {
275 if (!input.trim() || status !== "idle" || !config.anthropicApiKey) return;
276
277 const userText = input.trim();
323 };
324
325 const canSend = input.trim() && status === "idle" && config.anthropicApiKey;
326
327 /* ── UI ─────────────────────────────────────────────────────── */
329 <>
330 <div className="chat-messages">
331 {!config.anthropicApiKey && (
332 <div className="message system">
333 Please configure your Anthropic API key in settings to start chatting
334 </div>
335 )}
369 onChange={(e) => setInput(e.target.value)}
370 onKeyPress={handleKeyPress}
371 placeholder={config.anthropicApiKey
372 ? streaming
373 ? "Press Enter to stop streaming…"
374 : "Type your message…"
375 : "Configure API key in settings first"}
376 className="chat-input"
377 disabled={!config.anthropicApiKey || thinking}
378 rows={1}
379 />

discord-random-botREADME.md1 match

@stabbylambdaβ€’Updated 13 hours ago
75- Voice channel has fewer than 2 people
76- Bot lacks necessary permissions
77- Network or Discord API issues
78
79## Technical Details

todo-appindex.html1 match

@diegoivoβ€’Updated 13 hours ago
7 <script src="https://cdn.twind.style" crossorigin></script>
8 <script src="https://esm.town/v/std/catch"></script>
9 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
10 <style>
11 * {

eink-framecomponents.tsx6 matches

@michaelwschultzβ€’Updated 13 hours ago
9 <meta charSet="UTF-8" />
10 <title>{title}</title>
11 <link rel="preconnect" href="https://fonts.googleapis.com" />
12 {/* Getting a type error here */}
13 {/* <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> */}
14 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet" />
15 <link href="https://fonts.googleapis.com/css2?family=Doto:wght@100..900&display=swap" rel="stylesheet" />
16 <link href="https://fonts.googleapis.com/css2?family=Rancho&display=swap" rel="stylesheet" />
17 <link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet" />
18 <link
19 href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
20 rel="stylesheet"
21 />

reactHonoStarterApp.tsx1 match

@notmartβ€’Updated 13 hours ago
31 useEffect(() => {
32 const getMyIp = async () => {
33 const response = await fetch("https://api.ipify.org?format=json");
34 const data = await response.json();
35 setMyIp(data.ip);

Upworkindex.ts3 matches

@PortfolioFreelanceβ€’Updated 14 hours ago
32});
33
34// API endpoint for contact form (placeholder)
35app.post("/api/contact", async c => {
36 const body = await c.req.json();
37
51
52// Health check endpoint
53app.get("/api/health", c => {
54 return c.json({ status: "ok", timestamp: new Date().toISOString() });
55});

HN-fetch-call2 file matches

@ImGqbβ€’Updated 1 day ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openaiβ€’Updated 3 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
snartapi
Kapil01