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/?q=api&page=824&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 11605 results for "api"(1698ms)

valleBlogV0main.tsx1 match

@wlxiaozhzhUpdated 8 months ago
38 model: openai("gpt-4o", {
39 baseURL: "https://std-openaiproxy.web.val.run/v1",
40 apiKey: Deno.env.get("valtown"),
41 } as any),
42 messages: [

VALLEREADME.md3 matches

@wlxiaozhzhUpdated 8 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"/>

bbaasmain.tsx1 match

@dglazkovUpdated 8 months ago
94 if (!inputs.$key || inputs.$key != Deno.env.get("BB_SERVICE_KEY")) {
95 return {
96 $error: "Must provide an API key to access the service.",
97 };
98 }

sweetAzureFinchmain.tsx4 matches

@cingozilyasUpdated 8 months ago
2
3export default async function saveToAirtable(videoName, videoDescription, videoCover, videoFile, clientLogo) {
4 // Set up your Airtable API key and base ID
5 const API_KEY = "patrq3goiFF1u09Dz.b435affff5fb534b9d5c76e2544ddf88612d6a19aebaec5c14f9434b0d10d2e6";
6 const BASE_ID = "appoxM2jYcSNhc5OX";
7 const TABLE_NAME = "videos_from_ssa";
8
9 // Initialize Airtable with your API key
10 Airtable.configure({ apiKey: API_KEY });
11 const base = Airtable.base(BASE_ID);
12

reloadOnSaveREADME.md1 match

@lisardoUpdated 8 months ago
1# Live reload in new tabs
2
3When you're working on an HTML HTTP val in a new tab, it's annoying to have to manually reload the tab on every save. In the Val Town editor, you can hit cmd+enter, but there's nothing like that for a val in a new tab because Val Town doesn't control that new tab (like we control the iframe in the browser preview). However, you control that HTML via the fetch handler you're writing, so you can add a script that polls the Val Town API for the current version number of your val, and reload itself if it detects a new version. This val has a collection of helpers to help you do just that.
4
5## Usage

linkInBioTemplatemain.tsx1 match

@OliveUpdated 8 months ago
174 <title>Side School Seminar</title>
175 <meta name="viewport" content="width=device-width, initial-scale=1">
176 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
177 <style>${css}</style>
178 </head>

weeksummarymain.tsx3 matches

@ejfoxUpdated 8 months ago
37 prev => [...prev, `Fetching scraps and generating summary for week of ${weekStart.toDateString()}...`],
38 );
39 const response = await fetch(`/api/summary?week=${weekStart.toISOString()}`);
40 const data = await response.json();
41
120 <footer className="mt-8 text-center text-sm">
121 <h3>curl</h3>
122 <pre class="bg-black text-white text-sm font-mono">curl 'https://ejfox-weeksummary.web.val.run/api/summary?week=2024-06-16T00:00:00.000Z'</pre>
123
124 <a
146 const url = new URL(request.url);
147
148 if (url.pathname === "/api/summary") {
149 const { OpenAI } = await import("https://esm.town/v/std/openai");
150 const openai = new OpenAI();

VALLErunmain.tsx11 matches

@ejfoxUpdated 8 months ago
211 Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
212 Start your response with a comment explaining how your approach will work, what libraries or
213 API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
214 the simplest way to achieve the goal, though you can add some inline comments to explain your
215 reasoning (not for every line, but for major groups of lines). Don't use any environment variables
216 unless strictly necessary, for example use APIs that don't require a key, prefer internal function
217 imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
218 functions where possible. Unless specified, don't add error handling,
219 make sure that errors bubble up to the caller.
220 Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
221 not practical for the user's request (e.g. if they ask for a particular animated gif).
222 If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
223 explicitly specified otherwise. Use the current val name for the storage key, which you can get
224 using the "pomdtr/extractValInfo" val, which you can call like this:
273Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
274Add comments at the top of the file explaining how your approach works, what libraries or
275API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
276the simplest way to achieve the goal, though you can add some inline comments to explain your
277reasoning (not for every line, but for major groups of lines). Don't use any environment variables
278unless strictly necessary, for example use APIs that don't require a key, prefer internal function
279imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
280functions where possible. Unless specified, don't add error handling,
281make sure that errors bubble up to the caller.
282Avoid external images or base64 images, use emojis, unicode symtols, or icon fonts/libraries instead, unless that's
283not practical for the user's request (e.g. if they ask for a particular animated gif).
284If the user asks for something that requires persistence, use the Val Town Blob storage API, unless
285explicitly specified otherwise. Use the current val name for the storage key, which you can get
286using the "pomdtr/extractValInfo" val, which you can call like this:
389 \`\`\`
390
391 ### Lower-level API
392
393 We do provide access to the lower-level getter and setters, which are useful if you are storing non-JSON or binary data, need to stream in your response or request data, or do anything else lower-level.
394
395 - \`async get(key: string)\`: Retrieves a blob for a given key.
396 - \`async set(key: string, value: string | BodyInit)\`: Sets the blob value for a given key. See [BodyInit](https://deno.land/api@v1.38.1?s=BodyInit).
397
398 ### Limitations
1204
1205 const tempValName = `valle_tmp_${Math.random() * 10}`.replaceAll(".", "");
1206 // Errors in running the val bubble up through this API, so ignore them.
1207 await vt.vals.create({ name: tempValName, code: newCode, type: "http" as any, privacy: "unlisted" }).catch(
1208 (error) => {

slackScoutREADME.md4 matches

@sarahxcUpdated 8 months ago
7## Getting Started
8To run Slack Scout, you’ll need a
9- Browserbase API key
10- Slack Webhook URL: setup [here](https://docs.val.town/integrations/slack/send-messages-to-slack/)
11- Twitter Developer API key
12
13### Browserbase
19### Twitter
20
21We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. _If you decide to use Browserbase, we can lend our token. Comment below for access._
22
23Once you have the `SLACK_WEBHOOK_URL`, `BROWSERBASE_API_KEY`, and `TWITTER_BEARER_TOKEN`, input all of these as [Val Town Environment Variables](https://www.val.town/settings/environment-variables).
24
25---

githubGistsmain.tsx1 match

@scottUpdated 8 months ago
3// GitHub gists
4export let githubGists = fetchJSON(
5 "https://api.github.com/users/stevekrouse/gists",
6);
7

new-val-api-21 file match

@shouserUpdated 14 hours ago
This is an example of using the API to create a val.

gptApiTemplate2 file matches

@charmaineUpdated 1 day ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration