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/%22mailto:kurt@sachersolutions.ca/%22https:/fonts.gstatic.com//%22https:/cdn.twind.style/%22?q=api&page=1&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 25521 results for "api"(1861ms)

Gemini-2-5-Pro-O-01

Gemini-2-5-Pro-O-01main.tsx28 matches

@aibotcommander•Updated 17 mins ago
19 provider: "google",
20 model: "gemini-2.5-pro",
21 endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
22 headers: {
23 "Content-Type": "application/json",
28 provider: "google",
29 model: "gemini-1.5-flash",
30 endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent",
31 headers: {
32 "Content-Type": "application/json",
37 provider: "google",
38 model: "models/gemini-2.5-pro",
39 endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
40 headers: {
41 "Content-Type": "application/json",
77};
78
79const POE_API_KEYS = [
80 process.env.POE_API_KEY,
81 process.env.POE_API_KEY2,
82 process.env.POE_API_KEY3,
83].filter(Boolean);
84
90
91 const providedKey = req.headers.get("Authorization")?.replace("Bearer ", "") ||
92 req.headers.get("X-API-Key") ||
93 req.headers.get("X-Bot-Access-Key");
94
96 return {
97 isValid: false,
98 error: "Missing authentication. Please provide BOT_ACCESS_KEY in Authorization header, X-API-Key header, or X-Bot-Access-Key header."
99 };
100 }
110}
111
112function createPoeClient(apiKey: string): OpenAI {
113 return new OpenAI({
114 apiKey: apiKey || "YOUR_POE_API_KEY",
115 baseURL: "https://api.poe.com/v1",
116 });
117}
127 model: string,
128 prompt: string,
129 apiKeyIndex: number,
130 taskType: string,
131 timeout: number = 15000,
133): Promise<string | null> {
134 try {
135 const apiKey = POE_API_KEYS[apiKeyIndex];
136 const poeClient = createPoeClient(apiKey);
137
138 const maxTokens = selectOptimalTokens(prompt.length, taskType);
164 return content && content.trim().length > 0 ? content : null;
165 } catch (error) {
166 console.error(`Model ${model} failed with API key ${apiKeyIndex + 1}:`, error.message);
167 return null;
168 }
184 const promises: Promise<{result: string | null, model: string, keyIndex: number}>[] = [];
185
186 for (let keyIndex = 0; keyIndex < Math.min(POE_API_KEYS.length, 2); keyIndex++) {
187 for (const model of parallelModels) {
188 promises.push(
201
202 if (successful) {
203 console.log(`Success with ${successful.value.model} (API key ${successful.value.keyIndex + 1})`);
204
205 if (isImageGeneration) {
231 console.log("Trying remaining models sequentially...");
232 for (const model of remainingModels) {
233 for (let keyIndex = 0; keyIndex < POE_API_KEYS.length; keyIndex++) {
234 const result = await callSinglePoeModel(model, prompt, keyIndex, taskType, timeout, isImageGeneration);
235 if (result) {
276}
277
278async function callGeminiApi(
279 config: ModelConfig,
280 prompt: string,
308 };
309
310 const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311 const response = await fetch(url, {
312 method: "POST",
318 if (!response.ok) {
319 const errorText = await response.text();
320 throw new Error(`${config.model} API error: ${response.status} - ${errorText}`);
321 }
322
371
372 if (shouldUseFast) {
373 const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, prompt, send, "Text Generation");
374 if (flashResult) return;
375 } else {
376 // For complex queries, try Gemini Pro first
377 const proResult = await callGeminiApi(GEMINI_PRO_CONFIG, prompt, send, "Text Generation");
378 if (proResult) return;
379 }
416
417 // Try fast model first for file analysis
418 const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, analysisPrompt, send, "File Analysis");
419 if (flashResult) return;
420
447
448 // Try Gemini Pro with vision first
449 const geminiResult = await callGeminiApi(GEMINI_VISION_CONFIG, analysisPrompt, send, "Image Analysis", imageUrl);
450 if (geminiResult) return;
451
484 if (!poeResult) {
485 // Fallback to Gemini Flash for search
486 const geminiResult = await callGeminiApi(GEMINI_FLASH_CONFIG, searchPrompt, send, "Web Search");
487 if (!geminiResult) {
488 send("error", {
733 headers: {
734 "Content-Type": "application/json",
735 "WWW-Authenticate": "Bearer realm=\"Bot API\"",
736 },
737 });
Gemini-2-5-Pro-O-02

Gemini-2-5-Pro-O-02main.tsx28 matches

@aibotcommander•Updated 21 mins ago
19 provider: "google",
20 model: "gemini-2.5-pro",
21 endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
22 headers: {
23 "Content-Type": "application/json",
28 provider: "google",
29 model: "gemini-1.5-flash",
30 endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent",
31 headers: {
32 "Content-Type": "application/json",
37 provider: "google",
38 model: "models/gemini-2.5-pro",
39 endpoint: "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
40 headers: {
41 "Content-Type": "application/json",
77};
78
79const POE_API_KEYS = [
80 process.env.POE_API_KEY,
81 process.env.POE_API_KEY2,
82 process.env.POE_API_KEY3,
83].filter(Boolean);
84
90
91 const providedKey = req.headers.get("Authorization")?.replace("Bearer ", "") ||
92 req.headers.get("X-API-Key") ||
93 req.headers.get("X-Bot-Access-Key");
94
96 return {
97 isValid: false,
98 error: "Missing authentication. Please provide BOT_ACCESS_KEY in Authorization header, X-API-Key header, or X-Bot-Access-Key header."
99 };
100 }
110}
111
112function createPoeClient(apiKey: string): OpenAI {
113 return new OpenAI({
114 apiKey: apiKey || "YOUR_POE_API_KEY",
115 baseURL: "https://api.poe.com/v1",
116 });
117}
127 model: string,
128 prompt: string,
129 apiKeyIndex: number,
130 taskType: string,
131 timeout: number = 15000,
133): Promise<string | null> {
134 try {
135 const apiKey = POE_API_KEYS[apiKeyIndex];
136 const poeClient = createPoeClient(apiKey);
137
138 const maxTokens = selectOptimalTokens(prompt.length, taskType);
164 return content && content.trim().length > 0 ? content : null;
165 } catch (error) {
166 console.error(`Model ${model} failed with API key ${apiKeyIndex + 1}:`, error.message);
167 return null;
168 }
184 const promises: Promise<{result: string | null, model: string, keyIndex: number}>[] = [];
185
186 for (let keyIndex = 0; keyIndex < Math.min(POE_API_KEYS.length, 2); keyIndex++) {
187 for (const model of parallelModels) {
188 promises.push(
201
202 if (successful) {
203 console.log(`Success with ${successful.value.model} (API key ${successful.value.keyIndex + 1})`);
204
205 if (isImageGeneration) {
231 console.log("Trying remaining models sequentially...");
232 for (const model of remainingModels) {
233 for (let keyIndex = 0; keyIndex < POE_API_KEYS.length; keyIndex++) {
234 const result = await callSinglePoeModel(model, prompt, keyIndex, taskType, timeout, isImageGeneration);
235 if (result) {
276}
277
278async function callGeminiApi(
279 config: ModelConfig,
280 prompt: string,
308 };
309
310 const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311 const response = await fetch(url, {
312 method: "POST",
318 if (!response.ok) {
319 const errorText = await response.text();
320 throw new Error(`${config.model} API error: ${response.status} - ${errorText}`);
321 }
322
371
372 if (shouldUseFast) {
373 const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, prompt, send, "Text Generation");
374 if (flashResult) return;
375 } else {
376 // For complex queries, try Gemini Pro first
377 const proResult = await callGeminiApi(GEMINI_PRO_CONFIG, prompt, send, "Text Generation");
378 if (proResult) return;
379 }
416
417 // Try fast model first for file analysis
418 const flashResult = await callGeminiApi(GEMINI_FLASH_CONFIG, analysisPrompt, send, "File Analysis");
419 if (flashResult) return;
420
447
448 // Try Gemini Pro with vision first
449 const geminiResult = await callGeminiApi(GEMINI_VISION_CONFIG, analysisPrompt, send, "Image Analysis", imageUrl);
450 if (geminiResult) return;
451
484 if (!poeResult) {
485 // Fallback to Gemini Flash for search
486 const geminiResult = await callGeminiApi(GEMINI_FLASH_CONFIG, searchPrompt, send, "Web Search");
487 if (!geminiResult) {
488 send("error", {
733 headers: {
734 "Content-Type": "application/json",
735 "WWW-Authenticate": "Bearer realm=\"Bot API\"",
736 },
737 });

SonarApp.tsx1 match

@moe•Updated 22 mins ago
103 <div className="">âś· Farcaster mini app manifest + webhook + embed metadata</div>
104 <div className="">âś· Farcaster notifications (storing tokens, sending recurring notifications, ...)</div>
105 <div className="">âś· Neynar API integration for Farcaster data</div>
106 <div className="">âś· Hosted on Val Town (instant deployments on save)</div>
107 <div className="">

SonarSearchScreen.tsx1 match

@moe•Updated 33 mins ago
64 onChange={(e) => setQuery(e.target.value)}
65 placeholder="@user, fid:123, /channel, cast hash"
66 // autoCapitalize="on"
67 // autoCorrect="on"
68 type="text"

dotcomGoogol.tsx1 match

@petermillspaugh•Updated 34 mins ago
161 <em>do you want a domain for your cool new app?</em>{" "}
162 Regardless of where someone prefers to (vibe) code, registrars can meet
163 people where they are (e.g., by selling domains through an API or MCP
164 server). That’s not wholly a new idea—Squarespace is a website builder
165 after all—but it might be a bigger opportunity now.

dotcomtest.ts1 match

@petermillspaugh•Updated 46 mins ago
25}
26
27// const resend = new Resend(Deno.env.get("RESEND_API_KEY"));
28
29// const { data, error } = await resend.emails.send({

zoomtestmain.js9 matches

@yawnxyz•Updated 47 mins ago
222});
223
224// API endpoint to get current OAuth status
225app.get("/oauth/status", (c) => {
226 // In production, check actual token storage
1270
1271// RTMS Analysis Configuration
1272const OPENROUTER_API_KEY = Deno.env.get("OPENROUTER_API_KEY");
1273const OPENROUTER_MODEL = Deno.env.get("OPENROUTER_MODEL") || "meta-llama/llama-3.2-3b-instruct:free";
1274
1285const analysisClients = new Set();
1286
1287// OpenRouter API helper for trait analysis
1288async function analyzeTraitsWithOpenRouter(text) {
1289 if (!OPENROUTER_API_KEY) {
1290 console.warn("⚠️ OPENROUTER_API_KEY not set - skipping trait analysis");
1291 return { Curiosity: 0, Empathy: 0, Assertiveness: 0, Creativity: 0, Analytical: 0 };
1292 }
1319
1320 try {
1321 const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
1322 method: 'POST',
1323 headers: {
1324 'Authorization': `Bearer ${OPENROUTER_API_KEY}`,
1325 'Content-Type': 'application/json',
1326 'HTTP-Referer': 'https://val.town',
1335
1336 if (!response.ok) {
1337 throw new Error(`OpenRouter API error: ${response.status}`);
1338 }
1339
1517
1518 <div class="status">
1519 <strong>Status:</strong> ${OPENROUTER_API_KEY ? 'API Connected' : 'API Key Missing'}
1520 <br>
1521 <strong>WebSocket Clients:</strong> <span id="clientCount">0</span>

Sonarneynar.ts2 matches

@moe•Updated 1 hour ago
1const baseUrl = 'https://sonar.val.run/neynar-proxy?path='
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
3
4export async function fetchNeynarGet(path: string) {
8 'Content-Type': 'application/json',
9 'x-neynar-experimental': 'true',
10 'x-api-key': 'NEYNAR_API_DOCS',
11 },
12 })

location-feed-generatorcheckins.ts8 matches

@tijs•Updated 1 hour ago
1// Checkin creation API endpoint for Anchor
2import type { Context } from "jsr:@hono/hono@4.9.6";
3import { OverpassService } from "../services/overpass-service.ts";
17 */
18/**
19 * Convert API PlaceInput to proper Place object
20 */
21function _sanitizePlaceInput(input: PlaceInput): Place {
123}
124
125// API input format - coordinates might be strings
126interface PlaceInput {
127 name: string;
129 longitude: number | string;
130 tags: Record<string, string>;
131 // Optional fields that might be missing from API input
132 id?: string;
133 elementType?: "node" | "way" | "relation";
237 const { message } = body;
238
239 // Convert API input to proper Place object and validate coordinates
240 const place = _sanitizePlaceInput(body.place);
241 const lat = place.latitude;
255 console.log("🚀 Starting checkin creation process...");
256
257 // Get sessions instance for clean OAuth API access
258 const { sessions } = await import("../routes/oauth.ts");
259
295}
296
297// Create address and checkin records via AT Protocol using clean OAuth API
298async function createAddressAndCheckin(
299 sessions: OAuthSessionsInterface,
307 console.log(`đź”° Getting OAuth session for DID: ${did}`);
308
309 // Use the clean API to get a ready-to-use OAuth session
310 const oauthSession = await sessions.getOAuthSession(did);
311 if (!oauthSession) {

location-feed-generatorsettings.local.json2 matches

@tijs•Updated 1 hour ago
9 "Bash(/Users/tijs/projects/Anchor/location-feed-generator/scripts/test.sh:*)",
10 "Bash(./scripts/test.sh:*)",
11 "Bash(./scripts/test-api.sh:*)",
12 "Bash(vt list:*)",
13 "Bash(vt browse:*)",
14 "Bash(ls:*)",
15 "Bash(./scripts/monitor-api.sh:*)",
16 "Bash(swift test:*)",
17 "Bash(swift build:*)",

PixelPixelApiMonitor1 file match

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

weatherApp1 file match

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