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=7&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 19726 results for "api"(1477ms)

nightbot-master-commandnew-file-9775.tsx4 matches

@jaydenβ€’Updated 12 hours ago
41 advice: async () => {
42 console.log("handler.advice");
43 const res = await fetch("https://api.adviceslip.com/advice");
44 if (!res.ok) {
45 console.error("advice fetch failed", res.status);
64 trivia: async () => {
65 console.log("handler.trivia");
66 const res = await fetch("http://numbersapi.com/random/trivia?json");
67 if (!res.ok) {
68 console.error("trivia fetch failed", res.status);
74 compliment: async () => {
75 console.log("handler.compliment");
76 const res = await fetch("https://complimentr.com/api");
77 if (!res.ok) {
78 console.error("compliment fetch failed", res.status);
215
216 // try {
217 // const res = await fetch(`https://ohmanda.com/api/horoscope/${sign}`);
218 // if (!res.ok) {
219 // console.error("horoscope fetch failed", res.status);

ChatREADME.md7 matches

@c15rβ€’Updated 13 hours ago
1# Anthropic Streaming Chat with MCP
2
3A mobile-optimized single page chat application that uses the Anthropic Messages API with **real-time streaming** and MCP (Model Context Protocol) server support, featuring **centralized client management** and **performance optimizations**.
4
5Source: https://www.val.town/x/c15r/Chat
38const clientPool = new MCPClientPool(connectedClients, serverConfigs);
39
40// Unified API across all components
41await clientPool.testServer(serverName);
42await clientPool.fetchTools();
116
117The app stores configuration and chat history in localStorage:
118- `anthropic_api_key`: Your Anthropic API key
119- `selected_model`: The chosen Claude model (defaults to claude-3-5-sonnet-20241022)
120- `mcp_servers`: Array of configured MCP servers
144For detailed testing information, see [TESTING.md](./TESTING.md).
145
146### API Endpoints
147
148- `GET /` - Main application (serves frontend)
155
1561. Open the app at the provided URL
1572. Click "Settings" in the footer to configure your Anthropic API key and select your preferred Claude model
1583. Add/remove/toggle MCP servers as needed
1594. Use the "Test" button next to each MCP server to verify connectivity (shows βœ… for success, ❌ for errors)
200- **Auto-scroll**: Messages automatically scroll to bottom during streaming
201- **Auto-resize**: Input field grows with content
202- **Error Handling**: Clear error messages for API issues with stream recovery
203- **Loading States**: Visual feedback during API calls and streaming
204- **Structured Responses**: MCP tool use and results are displayed in organized, collapsible sections
205- **Clean Interface**: Maximized chat area with no header, footer contains all controls

ChatStreamingChat.tsx8 matches

@c15rβ€’Updated 14 hours ago
177 /** Retry a user message */
178 const retryMessage = async (messageId: string) => {
179 if (status !== "idle" || !config.anthropicApiKey) return;
180
181 const userText = onRetryFromMessage(messageId);
203 console.log("[Chat] fire send", { userText, input });
204 const messageText = userText || input.trim();
205 if (!messageText || status !== "idle" || !config.anthropicApiKey) return;
206
207 // Only clear input if we're using the current input (not NextSteps execution)
262 };
263
264 const canSend = input?.trim() && status === "idle" && config.anthropicApiKey;
265
266 /* ── UI ─────────────────────────────────────────────────────── */
268 <>
269 <div className="chat-messages">
270 {!config.anthropicApiKey && (
271 <div className="message system">
272 Please configure your Anthropic API key in settings to start chatting
273 </div>
274 )}
379 }}
380 onKeyDown={handleKeyDown}
381 placeholder={config.anthropicApiKey
382 ? streaming
383 ? "Streaming…"
385 ? "Waiting for your input above…"
386 : "Type your message or / for commands…"
387 : "Configure API key in settings first"}
388 className="chat-input"
389 disabled={!config.anthropicApiKey || thinking || waitingForUser}
390 rows={1}
391 />
Plantfo

Plantfoindex.ts4 matches

@Lladβ€’Updated 14 hours ago
49}
50
51// Check if user is authenticated (for API endpoints)
52function isAuthenticated(c: any): boolean {
53 const sessionToken = getSignedCookie(c, SESSION_SECRET, "admin_session");
115});
116
117// API info endpoint moved to /api
118app.get("/api", async (c) => {
119 // Only show cache stats if authenticated
120 let cacheInfo = {};
133
134 return c.json({
135 message: "Plant Information API",
136 usage: "GET /plant/:name - Get information about a specific plant",
137 example: "/plant/rose",

weatherStylist_Skienmain.tsx2 matches

@sjaskeprutβ€’Updated 15 hours ago
3 const lon = 9.6090;
4
5 const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}`
6 + `&current_weather=true&hourly=relativehumidity_2m,precipitation_probability&timezone=Europe%2FOslo`;
7
8 try {
9 const res = await fetch(url);
10 if (!res.ok) throw new Error(`API error: ${res.status} ${res.statusText}`);
11 const data = await res.json();
12

Skien_Stylist_UImain.tsx2 matches

@sjaskeprutβ€’Updated 15 hours ago
5
6 // Fetch current weather + hourly humidity & precipitation from Open-Meteo
7 const url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}`
8 + `&current_weather=true&hourly=relativehumidity_2m,precipitation_probability&timezone=Europe%2FOslo`;
9
10 try {
11 const res = await fetch(url);
12 if (!res.ok) throw new Error(`API error: ${res.status} ${res.statusText}`);
13 const data = await res.json();
14

Skien_Stylistmain.tsx2 matches

@sjaskeprutβ€’Updated 16 hours ago
1export default async function main() {
2 const apiUrl = "https://val.town/x/sjaskeprut/weatherStylist_Skien"; // example
3
4 try {
5 const res = await fetch(apiUrl);
6 if (!res.ok) throw new Error(`Failed to fetch: ${res.status} ${res.statusText}`);
7

Weather_Skienmain.tsx1 match

@sjaskeprutβ€’Updated 16 hours ago
3
4const url =
5 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weathercode`;
6
7const res = await fetch(url);

untitled-2623main.tsx1 match

@choroukβ€’Updated 16 hours ago
1// @title SportifyMA Core API – Multilingual Event Info
2// @desc Returns event details, transport info, ticket mock, and alerts in user-selected language
3

weatherFetchermain.tsx1 match

@sjaskeprutβ€’Updated 16 hours ago
4
5 const url =
6 `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current=temperature_2m,weathercode`;
7
8 const res = await fetch(url);
Plantfo

Plantfo8 file matches

@Lladβ€’Updated 14 hours ago
API for AI plant info

scrapeCraigslistAPI1 file match

@shapedlinesβ€’Updated 1 day ago
apiry
snartapi