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=6&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 20501 results for "api"(4331ms)

client-generatorindex.html1 match

@cricks_unmixed4u•Updated 7 hours ago
32 id="message"
33 rows="4"
34 placeholder="What is the capital of France?"
35 class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
36 ></textarea>

client-generatorREADME.md3 matches

@cricks_unmixed4u•Updated 7 hours ago
4
5- Static file serving for the frontend
6- API routing for GPT wrapper functionality
7- Dynamic importing of external Val Town modules
8
10
11- `index.ts` - Main entry point with Hono app setup
12- `routes/serveGptWrapper.tsx` - GPT wrapper API endpoint
13
14## API Design
15
16The backend follows RESTful principles and includes proper error handling with full stack traces for debugging.

client-generatorknowledge.md14 matches

@cricks_unmixed4u•Updated 7 hours ago
14- Generate code in TypeScript or TSX
15- Add appropriate TypeScript types and interfaces for all data structures
16- Prefer official SDKs or libraries than writing API calls directly
17- Ask the user to supply API or library documentation if you are at all unsure about it
18- **Never bake in secrets into the code** - always use environment variables
19- Include comments explaining complex logic (avoid commenting obvious operations)
24### 1. HTTP Trigger
25
26- Create web APIs and endpoints
27- Handle HTTP requests and responses
28- Example structure:
135## GreenPTClient
136
137The `GreenPTClient` is a function that allows interaction with the GreenPT API for chat completions. It accepts a model parameter and provides an `invoke` method to send messages and retrieve responses asynchronously. To ensure API security, it requires an API key stored in environment variables.
138
139### Example Usage
146async function getChatResponse() {
147 const messages = [
148 { role: "user", content: "What is the capital of France?" },
149 ];
150
153 console.log("AI Response:", response);
154 } catch (error) {
155 console.error("Error invoking GreenPT API:", error);
156 }
157}
161```
162
163In this example, we create an instance of `GreenPTClient`, send a message asking about the capital of France, and log the AI's response. Error handling is included to catch any issues with the API call.
164
165### Email
228However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
229If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
230or by making an API request for it.
231
232## Val Town Platform Specifics
236- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
237- **Storage:** DO NOT use the Deno KV module for storage
238- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
239- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
240- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
241- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
242- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
243- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
244- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
245- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
279### Backend (Hono) Best Practices
280
281- Hono is the recommended API framework
282- Main entry point should be `backend/index.ts`
283- **Static asset serving:** Use the utility functions to read and serve project files:
303 });
304 ```
305- Create RESTful API routes for CRUD operations
306- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
307 ```ts
340 - For files in the project, use `readFile` helpers
341
3425. **API Design:**
343 - `fetch` handler is the entry point for HTTP vals
344 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`

huyhieumain.js13 matches

@lanly•Updated 7 hours ago
124 const shape = c.req.query('shape') ?? 'rect'
125 const showLabel = c.req.query('label') !== 'false' // Default to showing label
126 // Map stat types to labels and API statistic names
127 const statMap = {
128 download: { label: 'downloads', apiStat: 'install' },
129 install: { label: 'installs', apiStat: 'install' },
130 rating: { label: 'rating', apiStat: 'averagerating' }
131 }
132
159 }
160
161 // Fetch stats from VS Marketplace API
162 try {
163 // Use the correct VS Marketplace Gallery API with POST method
164 const apiUrl = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery'
165 console.log('Fetching extension stats for:', namespace)
166
179 }
180
181 const response = await fetch(apiUrl, {
182 method: 'POST',
183 headers: {
184 Accept: 'application/json;api-version=6.0-preview.1',
185 'Content-Type': 'application/json',
186 'User-Agent': 'HuyHieu Badge Service'
197
198 const data = await response.json()
199 console.log('API Response structure:', Object.keys(data))
200
201 const extensions = data.results?.[0]?.extensions
202 if (!extensions || extensions.length === 0) {
203 console.warn('No extensions found in API response')
204 statValue = 'ExtensionNotFound'
205 }
206
207 const extension = extensions[0]
208 const targetStat = extension.statistics?.find(stat => stat.statisticName === statConfig.apiStat)
209 let statValue = targetStat?.value
210 if (!targetStat) {
211 console.log(`Statistic '${statConfig.apiStat}' not found. Available:`, extension.statistics?.map(s => s.statisticName))
212 statValue = 0
213 }

houseCommitteeMeetingQuickCheckdata.js12 matches

@blackerby•Updated 7 hours ago
2import { sqlite } from "https://esm.town/v/std/sqlite";
3
4const api_key = Deno.env.get("GPO_API_KEY");
5const date = new Date();
6const current_congress = (date.getFullYear() - 1789) / 2 + 1;
7const cdg_api_base_url = `https://api.congress.gov/v3/committee-meeting/${current_congress}/house`;
8const cdg_base_url = `https://www.congress.gov/event/${current_congress}/house`;
9const house_repo_base_url = "https://docs.house.gov/Committee/Calendar/ByEvent.aspx?EventID=";
27
28for (let eventId of eventIds) {
29 const cdg_api_url = `${cdg_api_base_url}/${eventId}?api_key=${api_key}&format=json`;
30 const cdg_api_url_xml_priv = `${cdg_api_base_url}/${eventId}?api_key=${api_key}&format=xml`;
31 const cdg_api_url_json = `${cdg_api_base_url}/${eventId}?api_key=DEMO_KEY&format=json`;
32 const cdg_api_url_xml = `${cdg_api_base_url}/${eventId}?api_key=DEMO_KEY&format=xml`;
33 const cdg_url = `${cdg_base_url}/${eventId}`;
34 const house_repo_url = `${house_repo_base_url}${eventId}`;
35 const json_resp = await fetch(cdg_api_url);
36 const xml_resp = await fetch(cdg_api_url_xml_priv);
37 await sqlite.execute({
38 sql:
39 `insert into meetings(event_id, cdg_api_url_json, cdg_json_status, cdg_api_url_xml, cdg_xml_status, cdg_url, house_repo_url)
40 values (:event_id, :cdg_api_url_json, :cdg_json_status, :cdg_api_url_xml, :cdg_xml_status, :cdg_url, :house_repo_url)`,
41 args: {
42 event_id: eventId,
43 cdg_api_url_json: cdg_api_url_json,
44 cdg_json_status: json_resp.status,
45 cdg_api_url_xml: cdg_api_url_xml,
46 cdg_xml_status: xml_resp.status,
47 cdg_url: cdg_url,

mouthyindex.html1 match

@join•Updated 7 hours ago
506 let currentVisemeTransitionTimeout; // Manages the sequence of intermediate visemes
507
508 // Web Speech API setup
509 const speechUtterance = new SpeechSynthesisUtterance();
510 const synth = window.speechSynthesis;

client-generatormain.tsx1 match

@cricks_unmixed4u•Updated 7 hours ago
129 }
130
131 // Handle API requests on POST
132 if (req.method !== "POST") {
133 return new Response("Method not allowed", { status: 405 });

create-safehash-serverclient.tsx20 matches

@ianmenethil•Updated 7 hours ago
266 // === Payment Variables (Easily Visible) ===
267 const [credentials, setCredentials] = useState({
268 apikey: 'a',
269 username: 'b',
270 password: 'p',
327
328 const areCredentialsComplete = () => {
329 return credentials.apikey && credentials.username && credentials.password;
330 };
331
353 setTimestamp(ts);
354
355 // Use page nonce from meta tag (no API fallback for security)
356 if (!metaNonce) {
357 setPayError('Security error: No payment nonce found. Please refresh the page and try again.');
380 let hash = '';
381 try {
382 const hashEndpoint = \`\${SERVER_URL}/api/create-payment-hash\`;
383 const apiResponse = await fetch(hashEndpoint, {
384 method: 'POST',
385 headers: {
391 credentials: 'include', // For cookies
392 body: JSON.stringify({
393 apikey: credentials.apikey,
394 username: credentials.username,
395 password: credentials.password,
401 });
402
403 if (!apiResponse.ok) {
404 const errorText = await apiResponse.text();
405 let errorMsg;
406 try {
407 const errorData = JSON.parse(errorText);
408 errorMsg = errorData.error || 'Hash API failed';
409 } catch {
410 errorMsg = 'Hash API returned ' + apiResponse.status;
411 }
412 throw new Error(errorMsg);
413 }
414
415 hash = await apiResponse.text();
416 logDebug({ type: 'hash-response', response: hash });
417 } catch (err) {
418 const msg = err instanceof Error ? err.message : String(err);
419 setPayError('Hash API failed: ' + msg);
420 logDebug({ type: 'error', error: 'Hash API failed: ' + msg });
421 setIsProcessing(false);
422 return;
428 url: 'https://payuat.travelpay.com.au/online/v5',
429 merchantCode,
430 apiKey: credentials.apikey,
431 fingerprint: hash,
432 redirectUrl: window.location.href,
485 key: 'cred-title',
486 className: "text-xl font-semibold mb-3"
487 }, 'API Credentials'),
488 React.createElement(Input, {
489 key: 'apikey',
490 label: "API Key",
491 name: "apikey",
492 value: credentials.apikey,
493 onChange: handleCredentialChange,
494 className: "mb-3"
565 key: 'tours-disabled-msg',
566 className: "text-sm text-gray-600 mb-3"
567 }, 'Please enter API credentials to enable tour selection'),
568 ...tours.map((tour) =>
569 React.createElement(Card, {

lumalabs-starterREADME.md3 matches

@charmaine•Updated 8 hours ago
5## Files
6
7- `types.ts` - TypeScript interfaces for API requests/responses and Luma AI data structures
8
9## Types
10
11- `VideoGeneration` - Complete video generation object from Luma AI API
12- `GenerationRequest` - Request payload for creating new generations
13- `GenerationResponse` - Standardized API response wrapper

lumalabs-starterREADME.md5 matches

@charmaine•Updated 8 hours ago
1# Backend
2
3Hono-based API server for Luma AI video generation.
4
5## API Endpoints
6
7### POST /api/generate
8Creates a new video generation request.
9
28```
29
30### GET /api/generation/:id
31Gets the status and details of a video generation.
32
50## Environment Variables
51
52- `LUMAAI_API_KEY` - Required. Your Luma AI API key
53
54## Static File Serving

claude-api1 file match

@ziyanwould•Updated 38 mins ago

api-workshop

@danarddanielsjr•Updated 1 day ago
replicate
Run AI with an API
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)