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=963&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 11601 results for "api"(883ms)

safeCountermain.tsx5 matches

@stevekrouseUpdated 1 year ago
1import { runValAPI } from "https://esm.town/v/stevekrouse/runValAPI";
2import { safeCounter as safeCounter2 } from "https://esm.town/v/stevekrouse/safeCounter";
3import { sleep } from "https://esm.town/v/stevekrouse/sleep";
22 // value of it, now that I know it can't be updated until I release this lock.
23 //
24 // Note 2: I use `@stevekrouse.runValAPI` here instead of `api` (used below)
25 // because `api` only works on funcitons and @stevekrouse.threadsafeStateEx
26 // is a JSON val.
27 let { state } = await runValAPI(
28 "@stevekrouse.threadsafeStateEx",
29 );
30 // 5. Update the state
31 //
32 // Note 3: I update the state via an API call here to ensure that the state
33 // is fully updated *before* I release the lock. If I were to update the state
34 // directly in this val, `@stevekrouse.updateThreadsafeStateEx = `, those

myApimain.tsx1 match

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

myApimain.tsx1 match

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

runAgentmain.tsx5 matches

@jacoblee93Updated 1 year ago
6 const { ChatOpenAI } = await import("npm:langchain/chat_models/openai");
7 const { ChatAnthropic } = await import("npm:langchain/chat_models/anthropic");
8 const { DynamicTool, Tool, SerpAPI } = await import("npm:langchain/tools");
9 const { initializeAgentExecutorWithOptions } = await import(
10 "npm:langchain/agents"
19 );
20 const model = new ChatOpenAI({
21 openAIApiKey: process.env.OPENAI_API_KEY,
22 modelName: "gpt-4",
23 maxTokens: 2048,
25 const anthropicModel = new ChatAnthropic({
26 modelName: "claude-v1",
27 anthropicApiKey: process.env.ANTHROPIC_API_KEY,
28 temperature: 0,
29 });
73 },
74 }),
75 new SerpAPI(process.env.SERPAPI_API_KEY, {
76 location: "Austin,Texas,United States",
77 hl: "en",
100💬 Google Vertex AI chat model + embeddings
101🔎 Google Custom Search tool
102⛓️ API chain: make API calls from docs
103
104Read on 🧵

myApimain.tsx1 match

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

stopDeparturesmain.tsx1 match

@kogniseUpdated 1 year ago
16 const json = await fetchJSON(url, {
17 headers: {
18 apiKey: process.env.transit,
19 },
20 });

githubUsermain.tsx1 match

@hkgUpdated 1 year ago
3// Github profile
4export let githubUser = fetchJSON(
5 "https://api.github.com/users/stevekrouse"
6);

myApiAddmain.tsx1 match

@acmuUpdated 1 year ago
2let { nameList } = await import("https://esm.town/v/acmu/nameList");
3
4export async function myApiAdd(name) {
5 if (Array.isArray(nameList)) {
6 nameList.push(name);

textToImageDallemain.tsx1 match

@hootzUpdated 1 year ago
13 }[];
14 } = await fetchJSON(
15 "https://api.openai.com/v1/images/generations",
16 {
17 method: "POST",

myApimain.tsx1 match

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

new-val-api-21 file match

@shouserUpdated 11 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