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?q=api&page=1047&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 11844 results for "api"(1037ms)

myApimain.tsx1 match

@igor•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

myApimain.tsx1 match

@tech_aly•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

gpt3main.tsx10 matches

@patrickjm•Updated 1 year ago
6
7/**
8 * OpenAI text completion. https://platform.openai.com/docs/api-reference/completions
9 *
10 * val.town has generously provided a free daily quota. Until the quota is met, no need to provide an API key.
11 * To see if the quota has been met, you can run @patrickjm.openAiFreeQuotaExceeded()
12 *
13 * For full REST API access, see @patrickjm.openAiTextCompletion
14 */
15export let gpt3 = async (params: {
20 const MODEL = "text-davinci-003";
21
22 // Determine whether to use provided apiKey or free usage apiKey based on daily quota.
23 const apiKey = params.openAiKey ?? openAiFreeUsageConfig.key;
24 const exceeded = await openAiFreeQuotaExceeded();
25 if (!params.openAiKey && exceeded) {
27 }
28
29 // If using free token, first check inputs against moderation api
30 if (!params.openAiKey) {
31 const moderation = await openAiModeration({
32 apiKey,
33 input: params.prompt,
34 });
35 if (moderation.results.some((r) => r.flagged)) {
36 throw new Error(
37 "Sorry, this prompt was flagged by OpenAI moderation. If you provide your own API key, moderation will be turned off."
38 );
39 }
40 }
41
42 // Call completion API
43 const response = await openAiTextCompletion({
44 apiKey: apiKey,
45 prompt: params.prompt,
46 model: MODEL,

myApimain.tsx1 match

@danieledrisian•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

reachingFreeTierLimitmain.tsx4 matches

@andreterron•Updated 1 year ago
1import { paginateAPI } from "https://esm.town/v/andreterron/paginateAPI";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
3import process from "node:process";
15 };
16 const me = await fetchJSON(
17 "https://api.val.town/v1/me",
18 opts,
19 );
20 const vals = await paginateAPI(
21 `https://api.val.town/v1/users/${me.id}/vals?limit=100`,
22 opts,
23 );

createGeneratedValmain.tsx2 matches

@andreterron•Updated 1 year ago
7}) {
8 const code = await runVal(
9 "andreterron.generateValCodeAPI",
10 description,
11 );
12 const val = await fetchJSON(
13 `https://api.val.town/v1/vals`,
14 {
15 method: "POST",

postWebhookTest4main.tsx1 match

@val•Updated 1 year ago
2
3export let postWebhookTest4 = fetchJSON(
4 "https://api.val.town/express/@val.postWebhook5",
5 {
6 method: "POST",

holidaysUSmain.tsx1 match

@rcoady•Updated 1 year ago
3// Public holidays in the US in 2023
4export let holidaysUS = fetchJSON(
5 "https://date.nager.at/api/v2/publicholidays/2023/US"
6);

githubGistsmain.tsx1 match

@henri•Updated 1 year ago
3// GitHub gists
4export let githubGists = fetchJSON(
5 "https://api.github.com/users/stevekrouse/gists"
6);

myApimain.tsx1 match

@emilsall•Updated 1 year ago
1export function myApi(name) {
2 return "hiyyyy " + name;
3}

simple-scrabble-api1 file match

@bry•Updated 12 hours ago

social_data_api_project3 file matches

@tsuchi_ya•Updated 20 hours ago
apiv1
papimark21