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=590&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 10642 results for "api"(902ms)

aigeneratorblogmain.tsx19 matches

@websrai•Updated 4 months ago
27 const [adContent, setAdContent] = useState("");
28 const [selectedProvider, setSelectedProvider] = useState("OpenAI");
29 const [apiKey, setApiKey] = useState("");
30
31 useEffect(() => {
39 setUser(userData);
40 setSelectedProvider(userData.aiProvider || "OpenAI");
41 setApiKey(userData.apiKey || "");
42 };
43
55 method: "POST",
56 headers: { "Content-Type": "application/json" },
57 body: JSON.stringify({ topic, format, provider: selectedProvider, apiKey }),
58 });
59 const data = await response.json();
91 };
92
93 const handleApiKeyChange = async (e) => {
94 const newApiKey = e.target.value;
95 setApiKey(newApiKey);
96 await updateUserSettings({ apiKey: newApiKey });
97 };
98
160 </div>
161 <div>
162 <label htmlFor="apiKey" className="block mb-2">API Key:</label>
163 <input
164 type="password"
165 id="apiKey"
166 value={apiKey}
167 onChange={handleApiKeyChange}
168 placeholder="Enter your API key"
169 className="w-full p-2 border rounded"
170 />
172 <button
173 type="submit"
174 disabled={isLoading || (user && user.contentGenerated >= SUBSCRIPTION_TIERS[user.tier].contentLimit) || !apiKey}
175 className="w-full bg-blue-500 text-white p-2 rounded hover:bg-blue-600 disabled:opacity-50"
176 >
294 contentGenerated INTEGER NOT NULL,
295 aiProvider TEXT,
296 apiKey TEXT
297 )
298 `);
304 await sqlite.execute(`
305 INSERT INTO ${KEY}_users_${SCHEMA_VERSION}
306 (name, tier, contentGenerated, aiProvider, apiKey)
307 VALUES (?, ?, ?, ?, ?)
308 `, ["Demo User", "FREE", 0, "OpenAI", ""]);
341 if (url.pathname === "/generate") {
342 try {
343 const { topic, format, provider, apiKey } = await request.json();
344
345 // Get current user
429 }
430
431 if (settings.apiKey) {
432 updateFields.push("apiKey = ?");
433 updateValues.push(settings.apiKey);
434 }
435

jentlemans_botmain.tsx1 match

@artalar•Updated 4 months ago
7 // Verify this webhook came from our bot
8 if (
9 req.headers.get("x-telegram-bot-api-secret-token")
10 !== secret_token
11 ) {

seoKeywordResearchToolmain.tsx19 matches

@websrai•Updated 4 months ago
27 const [adContent, setAdContent] = useState("");
28 const [selectedProvider, setSelectedProvider] = useState("OpenAI");
29 const [apiKey, setApiKey] = useState("");
30
31 useEffect(() => {
39 setUser(userData);
40 setSelectedProvider(userData.aiProvider || "OpenAI");
41 setApiKey(userData.apiKey || "");
42 };
43
55 method: "POST",
56 headers: { "Content-Type": "application/json" },
57 body: JSON.stringify({ topic, format, provider: selectedProvider, apiKey }),
58 });
59 const data = await response.json();
91 };
92
93 const handleApiKeyChange = async (e) => {
94 const newApiKey = e.target.value;
95 setApiKey(newApiKey);
96 await updateUserSettings({ apiKey: newApiKey });
97 };
98
160 </div>
161 <div>
162 <label htmlFor="apiKey" className="block mb-2">API Key:</label>
163 <input
164 type="password"
165 id="apiKey"
166 value={apiKey}
167 onChange={handleApiKeyChange}
168 placeholder="Enter your API key"
169 className="w-full p-2 border rounded"
170 />
172 <button
173 type="submit"
174 disabled={isLoading || (user && user.contentGenerated >= SUBSCRIPTION_TIERS[user.tier].contentLimit) || !apiKey}
175 className="w-full bg-blue-500 text-white p-2 rounded hover:bg-blue-600 disabled:opacity-50"
176 >
294 contentGenerated INTEGER NOT NULL,
295 aiProvider TEXT,
296 apiKey TEXT
297 )
298 `);
304 await sqlite.execute(`
305 INSERT INTO ${KEY}_users_${SCHEMA_VERSION}
306 (name, tier, contentGenerated, aiProvider, apiKey)
307 VALUES (?, ?, ?, ?, ?)
308 `, ["Demo User", "FREE", 0, "OpenAI", ""]);
341 if (url.pathname === "/generate") {
342 try {
343 const { topic, format, provider, apiKey } = await request.json();
344
345 // Get current user
429 }
430
431 if (settings.apiKey) {
432 updateFields.push("apiKey = ?");
433 updateValues.push(settings.apiKey);
434 }
435

cerebras_coderREADME.md2 matches

@toowired•Updated 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

neatBlackSwiftREADME.md2 matches

@toowired•Updated 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

@toowired•Updated 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 />

spaceTradersStatusTableREADME.md1 match

@keo•Updated 4 months ago
1Simple Space Traders API status table.
2100% generated by Townie AI.

spaceTradersStatusTablemain.tsx3 matches

@keo•Updated 4 months ago
10 async function fetchStatus() {
11 try {
12 const response = await fetch('https://api.spacetraders.io/v2/');
13 if (!response.ok) throw new Error('Failed to fetch status');
14 const data = await response.json();
31 return (
32 <div style={styles.container}>
33 <h1 style={styles.title}>🚀 SpaceTraders API Status</h1>
34 <table style={styles.table}>
35 <thead>
130 <html>
131 <head>
132 <title>SpaceTraders API Status</title>
133 <meta name="viewport" content="width=device-width, initial-scale=1">
134 </head>

cerebras_coderREADME.md2 matches

@chrisagon•Updated 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

@chrisagon•Updated 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

daily-advice-app1 file match

@dcm31•Updated 1 day ago
Random advice app using Advice Slip API

gptApiTemplate1 file match

@charmaine•Updated 2 days ago
apiv1
papimark21