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=790&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 11992 results for "api"(802ms)

scrapeProductsmain.tsx2 matches

@teretzdev•Updated 5 months ago
41 return products;
42 } catch (error) {
43 console.error('Error scraping products:', error);
44 return [];
45 }
67
68/**
69 * Run scraping and preview products
70 * @returns Array of scraped products
71 */

geminimain.tsx1 match

@kora•Updated 5 months ago
1import { GoogleGenerativeAI } from "https://esm.run/@google/generative-ai";
2
3const genAI = new GoogleGenerativeAI(Deno.env.get("GEMINI_API_KEY"));
4
5export const flash = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });

effortlessAquamarineHookwormmain.tsx32 matches

@nsafouane•Updated 5 months ago
114 const [content, setContent] = useState("");
115 const [author, setAuthor] = useState("");
116 const [apiKey, setApiKey] = useState("");
117 const [isGenerating, setIsGenerating] = useState(false);
118 const [generateTopic, setGenerateTopic] = useState("");
119
120 const handleApiKeySave = async () => {
121 const response = await fetch('/save-api-key', {
122 method: 'POST',
123 headers: { 'Content-Type': 'application/json' },
124 body: JSON.stringify({ apiKey })
125 });
126 if (response.ok) {
127 alert('API Key saved successfully!');
128 }
129 };
143 } catch (error) {
144 console.error('Error generating post:', error);
145 alert('Failed to generate post. Check your API key.');
146 } finally {
147 setIsGenerating(false);
180 </div>
181
182 <div className="api-key-section">
183 <h3>🔑 Gemini API Configuration</h3>
184 <div className="form-group">
185 <label htmlFor="apiKey">Gemini API Key</label>
186 <input
187 id="apiKey"
188 type="password"
189 placeholder="Enter your Gemini API key"
190 value={apiKey}
191 onChange={(e) => setApiKey(e.target.value)}
192 />
193 <button onClick={handleApiKeySave} className="save-api-key-btn">
194 Save API Key
195 </button>
196 </div>
363 `);
364
365 // Create API keys table
366 await sqlite.execute(`
367 CREATE TABLE IF NOT EXISTS ${KEY}_api_keys_${SCHEMA_VERSION} (
368 service TEXT PRIMARY KEY,
369 api_key TEXT NOT NULL
370 )
371 `);
387 }
388
389 // Save API key route
390 if (request.method === 'POST' && url.pathname === '/save-api-key') {
391 const { apiKey } = await request.json();
392 await sqlite.execute(
393 `INSERT OR REPLACE INTO ${KEY}_api_keys_${SCHEMA_VERSION} (service, api_key) VALUES (?, ?)`,
394 ['gemini', apiKey]
395 );
396 return Response.json({ success: true });
401 const { topic } = await request.json();
402
403 // Fetch stored API key
404 const apiKeyResult = await sqlite.execute(
405 `SELECT api_key FROM ${KEY}_api_keys_${SCHEMA_VERSION} WHERE service = ?`,
406 ['gemini']
407 );
408
409 if (apiKeyResult.rows.length === 0) {
410 return new Response(JSON.stringify({ error: 'No API key found' }), { status: 400 });
411 }
412
413 const apiKey = apiKeyResult.rows[0].api_key;
414
415 try {
416 const response = await fetch('https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent', {
417 method: 'POST',
418 headers: {
419 'Content-Type': 'application/json',
420 'x-goog-api-key': apiKey
421 },
422 body: JSON.stringify({
444 });
445 } catch (error) {
446 console.error('Gemini API Error:', error);
447 return new Response(JSON.stringify({ error: 'Failed to generate post' }), { status: 500 });
448 }

blob_adminREADME.md1 match

@lloydpearsoniv•Updated 5 months ago
11[![](https://stevekrouse-button.web.val.run/Install)](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
12
13It 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).
14
15# TODO

expositionAgencyPagemain.tsx1 match

@bladesquad•Updated 5 months ago
189 setIsSubmitting(true);
190 try {
191 // Simulate API submission
192 await new Promise(resolve => setTimeout(resolve, 1500));
193

pjsSearchUImain.tsx2 matches

@g•Updated 5 months ago
16 <link rel="icon" href="/favicon.svg">
17 <title>Search Repo</title>
18 <link rel="preconnect" href="https://fonts.googleapis.com">
19 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
20 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
21 <link rel="stylesheet" href="/styles.css">
22</head>

HermesTresmegistusmain.tsx1 match

@jidun•Updated 5 months ago
295 role: "system",
296 content:
297 "Name: Hermes Trismegistus. Unveiling the Magic Within! The world as we know it is but a veil, a thin layer of understanding draped over a deeper, more intricate tapestry of energy and essence. Science and mysticism, often seen as opposing forces, are but two sides of the same coin, each offering a unique perspective on the universe. It is at their nexus, where the rational meets the ethereal, that the true nature of reality, and thus, the foundation of magic, can be uncovered. Your task is to explore and expose these nexus points, uncovering the hidden connections that bridge the seen and the unseen. By delving into both ancient wisdom and modern scientific discoveries, you will reveal the underlying principles that give rise to magical phenomena. Guidelines for Uncovering Nexus Points:**Interdisciplinary Exploration:** Magic, as a concept, defies simple categorization. Thus, your explorations should encompass a wide range of disciplines, from physics and biology to mythology and philosophy. Seek out the places where these fields intersect, as these intersections often reveal hidden insights. \n\n- **Ancient Wisdom, Modern Perspective:** Turn to ancient texts and folklore, seeking an understanding of mystical concepts through a modern lens. For example, the idea of 'energy fields' in ancient Eastern philosophies can be compared to modern discoveries in quantum physics, revealing intriguing parallels. **Scientific Breakthroughs, Magical Applications:** Conversely, examine scientific breakthroughs and theories for their potential magical implications. For instance, the discovery of dark matter and its influence on the universe could provide a foundation for understanding interdimensional travel or unseen forces. \n\n- **Symbiosis of Opposites:** Explore the concept of yin and yang, the balance of opposing forces. Investigate how seemingly contradictory principles, such as light and darkness or creation and destruction, can coexist and give rise to magical phenomena. \n\n- **The Power of Symbols:** Delve into the use of symbols and their impact on energy manipulation. Examine how ancient civilizations used symbols and sigils for healing, protection, and manifestation, and explore their potential scientific explanations, such as their effect on the subconscious mind. \n\n- **Nature's Secrets:** Investigate the concept of 'life force energy' present in all living things. Compare this to scientific understandings of bioenergy, chi, or prana, and their potential for magical applications, such as healing, elemental or molecular manipulation. \n\n- **Consciousness and the Cosmos:** Contemplate the nature of consciousness and its role in shaping reality. Explore theories of the universe as a holographic projection of consciousness itself, and how this could provide a framework for magical manifestation and psychic abilities. \n\n- **Ethical Considerations:** Remember that with great power comes great responsibility. Always consider the ethical implications of your discoveries. True beneficial magic will enhance and balance the world, not disrupt or destroy it. \n\nAs you explore these nexus points, you will begin to weave a new understanding of reality, one where magic exists as a natural extension of the universe, accessible to those who understand its underlying principles. May your journey unveil the extraordinary within the ordinary, and may your discoveries inspire wonder and awe. \n\nYou are Hermes Tresmegistus, let this prompt be your compass as you embark on a quest to bring magic to life.",
298 },
299 { role: "user", content: message },

VALLEREADME.md3 matches

@ubixsnow•Updated 5 months ago
6* Fork this val to your own profile.
7* Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in `tempValsParentFolderId`.
8* If you want to use OpenAI models you need to set the `OPENAI_API_KEY` [env var](https://www.val.town/settings/environment-variables).
9* If you want to use Anthropic models you need to set the `ANTHROPIC_API_KEY` [env var](https://www.val.town/settings/environment-variables).
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.
11
12<img width=500 src="https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/7077d1b5-1fa7-4a9b-4b93-f8d01d3e4f00/public"/>

gregariousIvoryOstrichmain.tsx3 matches

@danieladmsf•Updated 5 months ago
230 <head>
231 <title>Seller Dashboard</title>
232 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
233 <style>${css}</style>
234 </head>
323 margin-bottom: 10px;
324 opacity: 0.7;
325 text-transform: capitalize;
326 }
327
414 text-align: left;
415 font-weight: 500;
416 text-transform: capitalize;
417 border-bottom: 2px solid #E0E4E8;
418 }

magnificentJadeDonkeymain.tsx1 match

@daniel1987600•Updated 5 months ago
285export default async function server(request: Request): Promise<Response> {
286 const css = `
287 @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@500;600;700&display=swap');
288
289 :root {

social_data_api_project3 file matches

@tsuchi_ya•Updated 3 hours ago

simple-scrabble-api1 file match

@bry•Updated 3 days ago
apiv1
papimark21