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/$%7Bart_info.art.src%7D?q=api&page=1433&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 18170 results for "api"(1794ms)

evalREADME.md1 match

@maxm•Updated 7 months ago
19```
20
21You can use this library with https://www.val.town/v/maxm/transformEvalCode to return the last value without needing to export it. This is how the /eval api endpoint used to work and makes the library preform similarly to a repl.
22
23```ts

VALLEREADME.md3 matches

@kate•Updated 7 months ago
6* Fork this val to your own profile.
7* Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in `tempValsParentFolderId`.
8* If you want to use OpenAI models you need to set the `OPENAI_API_KEY` [env var](https://www.val.town/settings/environment-variables).
9* If you want to use Anthropic models you need to set the `ANTHROPIC_API_KEY` [env var](https://www.val.town/settings/environment-variables).
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.
11
12<img width=500 src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/7077d1b5-1fa7-4a9b-4b93-f8d01d3e4f00/public"/>

lovableVioletLandfowlmain.tsx5 matches

@eligosmlytics•Updated 7 months ago
130 setHtmlContent('');
131 try {
132 const response = await fetch(`/api?url=${encodeURIComponent(url)}`);
133 if (!response.ok) {
134 throw new Error(`HTTP error! status: ${response.status}`);
243 </button>
244 </form>
245 <p className="note">Note: This tool uses the PageSpeed Insights API without authentication, which has usage limits. For higher quotas, consider using an API key.</p>
246 <div className="content-wrapper">
247 <div className="results-container">
316 const url = new URL(request.url);
317
318 if (url.pathname === "/api") {
319 const testUrl = url.searchParams.get("url");
320 if (!testUrl) {
328 }
329
330 const apiUrl = `https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${encodeURIComponent(testUrl)}`;
331
332 try {
333 const response = await fetch(apiUrl);
334 if (!response.ok) {
335 throw new Error(`HTTP error! status: ${response.status}`);

aqiREADME.md1 match

@mateoclarke•Updated 7 months ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

italymain.tsx1 match

@all•Updated 7 months ago
310 <head>
311 <title>Map of Italy</title>
312 <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Lora&display=swap" rel="stylesheet">
313 <meta name="viewport" content="width=device-width, initial-scale=1">
314 <style>${css}</style>

genuineGrayWrenmain.tsx3 matches

@stevekrouse•Updated 8 months ago
187
188 try {
189 const response = await fetch("/api/combine", {
190 method: "POST",
191 headers: {
286 const key = "infiniteUICombinations_3";
287
288 if (url.pathname === "/api/combinations") {
289 const { blob } = await import("https://esm.town/v/std/blob");
290 const storedCombinations = await blob.getJSON(key) || [];
294 }
295
296 if (url.pathname === "/api/combine" && request.method === "POST") {
297 const { item1, item2, model } = await request.json();
298 console.log("Server: Combining elements", item1, item2);

aqiREADME.md1 match

@snareco•Updated 8 months ago
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12

ChatGPTTextDefinitionUserscriptmain.tsx10 matches

@willthereader•Updated 8 months ago
79 };
80
81 const API_CONFIG = {
82 url: "https://willthereader-openaidefiner.web.val.run",
83 method: "POST",
203 };
204
205 async function processApiResponse(response) {
206 const reader = response.body.getReader();
207
235 try {
236 const originalSelection = isFollowUp ? popup.dataset.originalSelection : selectedText;
237 const response = await makeApiRequest(selectedText, isFollowUp ? originalSelection : null);
238 await processApiResponse(response);
239 if (isFollowUp) {
240 store.dispatch({
406 }
407
408 async function makeApiRequest(text, originalSelection = null) {
409 console.log(`makeApiRequest called with text: "${text}", originalSelection: "${originalSelection}"`);
410 try {
411 const extractedContext = extractSettingTags();
418 console.log(`Request body: ${body}`);
419
420 const response = await fetch(API_CONFIG.url, {
421 ...API_CONFIG,
422 body: body,
423 });
424
425 console.log(`API response status: ${response.status}`);
426
427 if (!response.ok) {
431 return response;
432 } catch (error) {
433 console.error(`Error in makeApiRequest: ${error.message}`);
434 throw new Error(`Failed to fetch definition from the server. Please try again. Error: ${error.message}`);
435 }

dm_callback_exampleREADME.md2 matches

@karanganesan•Updated 8 months ago
1Docs: https://docs.lumalabs.ai/docs/api#how-to-get-a-callback-when-generation-has-an-update
2
3you can now pass callback_url in the body of api / create function on python/js sdks.
4available on version 1.1.0
5

mlbScoreFetchermain.tsx4 matches

@charmaine•Updated 8 months ago
14 const fetchScores = async () => {
15 try {
16 const response = await fetch('/api/scores');
17 if (!response.ok) {
18 throw new Error('Failed to fetch scores');
47 <p>
48 <small>
49 Data source: <a href="http://statsapi.mlb.com">MLB Stats API</a> |{" "}
50 <a href={import.meta.url.replace("esm.town", "val.town")}>View source</a>
51 </small>
66 const url = new URL(request.url);
67
68 if (url.pathname === '/api/scores') {
69 try {
70 const mlbResponse = await fetch('https://statsapi.mlb.com/api/v1/schedule/games/?sportId=1');
71 const mlbData = await mlbResponse.json();
72

xxxclearinghouse_validator

@toowired•Updated 7 hours ago
Request validator for clearance API

Apiify11 file matches

@wolf•Updated 1 day ago
snartapi
apiry