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%22Optional%20title%22?q=api&page=1487&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 18001 results for "api"(2031ms)

valPreviewmain.tsx3 matches

@iamseeley•Updated 10 months ago
1export async function fetchVal(valId: string) {
2 try {
3 const response = await fetch(`https://api.val.town/v1/vals/${valId}`);
4 if (!response.ok) {
5 console.error(`Error fetching val with ID ${valId}:`, response.statusText);
15export async function evalCode(code: string) {
16 try {
17 const response = await fetch(`https://api.val.town/v1/eval`, {
18 method: 'POST',
19 headers: {
26 const errorText = await response.text();
27 console.error(`Error evaluating code:`, errorText);
28 return { error: `API Error: ${response.status} ${response.statusText}`, rawResponse: errorText };
29 }
30

examain.tsx1 match

@yawnxyz•Updated 10 months ago
2import Exa from "npm:exa-js"
3
4const exa = new Exa(Deno.env.get("EXA_API_KEY"));
5
6export const exaSearch = async ({ query, type, useAutoprompt, numResults, text, summary=true, highlights }) => {

btcmain.tsx3 matches

@park•Updated 10 months ago
12 try {
13 const [priceResponse, historyResponse] = await Promise.all([
14 fetch(`https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=${CONFIG.COIN_GECKO_CURRENCY}`),
15 fetch(
16 `https://api.coingecko.com/api/v3/coins/bitcoin/market_chart?vs_currency=${CONFIG.COIN_GECKO_CURRENCY}&days=${CONFIG.COIN_GECKO_DAYS}&interval=daily`,
17 ),
18 ]);
19
20 if (!priceResponse.ok || !historyResponse.ok) throw new Error("API request failed");
21
22 const priceData = await priceResponse.json();

similarSitesmain.tsx2 matches

@qiangua•Updated 10 months ago
2import Exa from "npm:exa-js";
3import { ComputeText, GenerateImage, sb, Substrate } from "npm:substrate";
4const exa = new Exa(Deno.env.get("EXA_API_KEY"));
5const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
6
7export default async function handler(req: Request): Promise<Response> {

similarSitesREADME.md1 match

@qiangua•Updated 10 months ago
3Powered by [Exa](https://exa.ai/) and [Substrate](https://substrate.run).
4
5🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits.

blob_adminREADME.md1 match

@nilesh•Updated 10 months ago
9[![](https://stevekrouse-button.express.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO

audioManagermain.tsx2 matches

@yawnxyz•Updated 10 months ago
43
44export class AudioManager {
45 constructor(apiKey=null, uploadFunction = null, downloadFunction = null) {
46 this.openai = new OpenAI(apiKey);
47 this.uploadFunction = uploadFunction || this.blobUpload;
48 }

fetchCongressTradeReportsmain.tsx1 match

@trickster•Updated 10 months ago
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14 );
15 const trades = res.data;
24Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
25Start your response with a comment explaining how your approach will work, what libraries or
26API calls you will use, and any tradeoffs you're making. Then write the code in a consise way,
27the simplest way to achieve the goal, though you can add some inline comments to explain your
28reasoning (not for every line, but for major groups of lines). Don't use any environment variables
29unless strictly necessary, for example use APIs that don't require a key, prefer internal function
30imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
31functions where possible. Unless specified, don't add error handling,
32make sure that errors bubble up to the caller.
23Make an HTTP val (other vals are currently not supported to run, even though we have examples for them).
24Start your response with a comment explaining how your approach will work, what libraries or
25API calls you will use, and any tradeoffs you're making. Then write the code in a concise way,
26the simplest way to achieve the goal, though you can add some inline comments to explain your
27reasoning (not for every line, but for major groups of lines). Don't use any environment variables
28unless strictly necessary, for example use APIs that don't require a key, prefer internal function
29imports (using esm.town), and prefer putting API keys as inline variables. Use built-in Deno
30functions where possible. Unless specified, don't add error handling,
31make sure that errors bubble up to the caller.

Apiify6 file matches

@wolf•Updated 20 mins ago

dailyQuoteAPI

@Souky•Updated 2 days ago
Kapil01
apiv1