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=687&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 12040 results for "api"(1027ms)

cerebras_coderREADME.md2 matches

@darkobodnarukUpdated 4 months ago
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
10
11# Todos

cerebras_codermain.tsx5 matches

@darkobodnarukUpdated 4 months ago
212 } catch (error) {
213 Toastify({
214 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
215 position: "center",
216 duration: 3000,
1024 };
1025 } else {
1026 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1027 const completion = await client.chat.completions.create({
1028 messages: [
1149 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1150 <title>CerebrasCoder</title>
1151 <link rel="preconnect" href="https://fonts.googleapis.com" />
1152 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1153 <link
1154 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1155 rel="stylesheet"
1156 />
1165 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1166 <meta property="og:type" content="website">
1167 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1168
1169

neatBlackSwiftREADME.md2 matches

@annathasanUpdated 4 months ago
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
10
11# Todos

neatBlackSwiftmain.tsx4 matches

@annathasanUpdated 4 months ago
1025 };
1026 } else {
1027 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1028 const thinkingCompletion = await client.chat.completions.create({
1029 messages: [
1033 another AI to code websites. You DO NOT code yourself. You just explain the plan.
1034 You can include inline code if you want to explain how to do something.
1035 Be sure to use APIs that don't require keys and that you know well. Explain the structure of the API.
1036 `,
1037 },
1170 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1171 <title>CerebrasCoder</title>
1172 <link rel="preconnect" href="https://fonts.googleapis.com" />
1173 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1174 <link
1175 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1176 rel="stylesheet"
1177 />

sqliteExplorerAppREADME.md1 match

@serdansUpdated 4 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@serdansUpdated 4 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

STARTER_PROMPTSmain.tsx1 match

@fame144Updated 4 months ago
12 },
13 {
14 prompt: "weather dashboard for nyc using open-meteo API for NYC with icons",
15 title: "Weather App",
16 code:

sqliteExplorerAppmain.tsx2 matches

@wiltUpdated 4 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

anthropicCachingmain.tsx30 matches

@toowiredUpdated 4 months ago
1/**
2 * This val creates an interactive webpage that demonstrates the functionality of the Anthropic API.
3 * It uses a React frontend with an input for the API key and buttons to trigger different operations.
4 * The Anthropic API key is stored in the frontend state and sent with each API request.
5 */
6
10
11function App() {
12 const [apiKey, setApiKey] = useState("");
13 const [outputs, setOutputs] = useState({
14 nonCachedCall: "",
23
24 const runOperation = async (operation: string) => {
25 if (!apiKey) {
26 alert("Please enter your Anthropic API key first.");
27 return;
28 }
35 "Content-Type": "application/json",
36 },
37 body: JSON.stringify({ apiKey }),
38 });
39 const result = await response.text();
52 <a href="https://github.com/anthropics/anthropic-cookbook/blob/7786b9f39db8ba65202792f564c59697a5222531/misc/prompt_caching.ipynb#L402">
53 this python notebook
54 </a>. Enter in your Anthropic API key (which is not saved) and click the buttons to see the results.
55 </p>
56 <p>
60 <input
61 type="password"
62 placeholder="Enter Anthropic API Key"
63 value={apiKey}
64 onChange={(e) => setApiKey(e.target.value)}
65 />
66 </div>
67 <div>
68 <button onClick={() => runOperation("nonCachedCall")} disabled={loading.nonCachedCall}>
69 Non-cached API Call
70 </button>
71 <button onClick={() => runOperation("cachedCall")} disabled={loading.cachedCall}>Cached API Call</button>
72 <button onClick={() => runOperation("multiTurn")} disabled={loading.multiTurn}>Multi-turn Conversation</button>
73 </div>
74 <h2>Non-cached API Call Output:</h2>
75 <pre>{loading.nonCachedCall ? "Loading..." : outputs.nonCachedCall}</pre>
76 <h2>Cached API Call Output:</h2>
77 <pre>{loading.cachedCall ? "Loading..." : outputs.cachedCall}</pre>
78 <h2>Multi-turn Conversation Output:</h2>
95 if (url.pathname === "/run") {
96 const operation = url.searchParams.get("operation");
97 const { apiKey } = await request.json();
98
99 if (!apiKey) {
100 return new Response("API key is required", { status: 400 });
101 }
102
104
105 if (operation === "nonCachedCall") {
106 result = await runNonCachedCall(apiKey);
107 } else if (operation === "cachedCall") {
108 result = "Making two calls, first one to cache...\n\n";
109 result += await runCachedCall(apiKey);
110 result += "\n\nNow the cached call...\n\n";
111 result += await runCachedCall(apiKey);
112 } else if (operation === "multiTurn") {
113 result = await runMultiTurnConversation(apiKey);
114 } else {
115 return new Response("Invalid operation", { status: 400 });
146}
147
148async function runNonCachedCall(apiKey: string): Promise<string> {
149 const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
150 const client = new anthropic.Anthropic({ apiKey });
151 const MODEL_NAME = "claude-3-5-sonnet-20240620";
152
175 const elapsedTime = (endTime - startTime) / 1000;
176
177 return `Non-cached API call time: ${elapsedTime.toFixed(2)} seconds
178Input tokens: ${response.usage.input_tokens}
179Output tokens: ${response.usage.output_tokens}
182}
183
184async function runCachedCall(apiKey: string): Promise<string> {
185 const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
186 const client = new anthropic.Anthropic({ apiKey });
187 const MODEL_NAME = "claude-3-5-sonnet-20240620";
188
212 const elapsedTime = (endTime - startTime) / 1000;
213
214 return `Cached API call time: ${elapsedTime.toFixed(2)} seconds
215Input tokens: ${response.usage.input_tokens}
216Output tokens: ${response.usage.output_tokens}
221}
222
223async function runMultiTurnConversation(apiKey: string): Promise<string> {
224 const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
225 const client = new anthropic.Anthropic({ apiKey });
226 const MODEL_NAME = "claude-3-5-sonnet-20240620";
227

cerebras_coderREADME.md2 matches

@rahstaUpdated 4 months ago
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
10
11# Todos

social_data_api_project3 file matches

@tsuchi_yaUpdated 14 hours ago

simple-scrabble-api1 file match

@bryUpdated 3 days ago
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
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com