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=17&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 11661 results for "api"(2866ms)

cerebras_coderindex.html3 matches

@WebmakerUpdated 1 day ago
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title>CerebrasCoder</title>
7 <link rel="preconnect" href="https://fonts.googleapis.com" />
8 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9 <link
10 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"
11 rel="stylesheet"
12 />
21 <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."">
22 <meta property="og:type" content="website">
23 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
24
25

cerebras_codergenerate-code.ts1 match

@WebmakerUpdated 1 day ago
16 };
17 } else {
18 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
19 const completion = await client.chat.completions.create({
20 messages: [

NowPlayingGrabbermain.tsx2 matches

@miclealUpdated 1 day ago
2import querystring from "npm:querystring";
3
4const NOW_PLAYING_ENDPOINT = "https://api.spotify.com/v1/me/player/currently-playing";
5const TOKEN_ENDPOINT = "https://accounts.spotify.com/api/token";
6
7const client_id = Deno.env.get("spotify_client_id");

templateTwitterAlertREADME.md4 matches

@divya88Updated 1 day ago
31Refer to [Twitter's search operators](https://socialdata.gitbook.io/docs/twitter-tweets/retrieve-search-results-by-keyword#endpoint-parameters) to fine-tune your query.
32
33### 4. Test API call
34Set `isProd = false` in the code if you are testing, to ensure there are enough tweets to display. <br>
35Toggle it back to `true` when you're ready to run this cron job in production and actuall send notifications.
60
61### NOTE: Usage Limits
62This val uses the SocialData API for Twitter data:
63
64- **Proxies via Val Town's [SocialDataProxy](https://www.val.town/v/stevekrouse/socialDataProxy)**: Limited to 10 cents per day for [**Val Town Pro users**](https://www.val.town/pricing). This API is *only* for Pro users.
65- **Need more calls?** Sign up for your own [SocialData API token](https://socialdata.tools) and configure the [`socialDataSearch`](https://www.val.town/v/stevekrouse/socialDataSearch) function.

growingEmeraldGrasshoppermain.tsx6 matches

@speedaddUpdated 1 day ago
4import React, { useEffect, useRef, useState } from "https://esm.sh/react@18.2.0";
5
6const ELEVENLABS_API_KEY = "sk_352c51c19a910aa3973cc146d057c11a1216da0eec41e0ee";
7const ELON_VOICE_ID = "UgBBYS2sOqTuMpoF3BR0"; // Specific Elon Musk voice ID
8
60 try {
61 for (const chunk of chunks) {
62 const response = await fetch(`https://api.elevenlabs.io/v1/text-to-speech/${ELON_VOICE_ID}`, {
63 method: "POST",
64 headers: {
65 "Content-Type": "application/json",
66 "xi-api-key": ELEVENLABS_API_KEY,
67 },
68 body: JSON.stringify({
161 setError(error.message);
162
163 // Fallback response if API fails
164 const fallbackResponse = {
165 role: "Character",
424 try {
425 const openai = new OpenAI({
426 apiKey:
427 "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",
428 });
432 console.log("Received messages:", JSON.stringify(messages, null, 2));
433
434 // Prepare messages for OpenAI API
435 const formattedMessages = [
436 { role: "system", content: CHARACTER_DESCRIPTION },
137
138 try {
139 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
140
141 const response = await fetch(url, {
166 }
167 } catch (error) {
168 console.error("Exception during API call:", error);
169 return { success: false, message: error.message };
170 }
162 }
163
164 const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`;
165
166 const response = await fetch(url, {
195
196 try {
197 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/labels`;
198
199 const response = await fetch(url, {
32};
33
34// Types for Slack API
35type SlackMessage = {
36 blocks: any[];
219
220 // Get PR details
221 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
222
223 let response;
241 return await response.json();
242 } catch (jsonError) {
243 throw new Error(`Failed to parse GitHub API response: ${jsonError.message}`);
244 }
245}
246
247// Merge a PR via GitHub API
248async function mergePR(repo: string, prNumber: number) {
249 const token = Deno.env.get("GITHUB_TOKEN");
282
283 // Proceed with merge
284 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/merge`;
285
286 const response = await fetch(url, {
99
100 try {
101 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/assignees`;
102
103 const response = await fetch(url, {
132 }
133 } catch (error) {
134 console.error("Exception during API call:", error);
135 return { success: false, message: error.message };
136 }
129
130 try {
131 const url = `https://api.github.com/repos/${repo}/issues/${prNumber}/assignees`;
132 console.log("🔍 Sending assignee request to:", url);
133
145 });
146
147 console.log("🔍 GitHub API response status:", response.status);
148
149 if (response.ok) {
155 try {
156 const error = await response.json();
157 console.error("❌ GitHub API error:", JSON.stringify(error));
158 errorMessage = error.message || errorMessage;
159
168 } catch (e) {
169 const errorText = await response.text();
170 console.error("❌ GitHub API error text:", errorText);
171 }
172 return { success: false, message: errorMessage };
173 }
174 } catch (error) {
175 console.error("❌ Exception during API call:", error);
176 return { success: false, message: error.message };
177 }

new-val-api-21 file match

@shouserUpdated 20 hours ago
This is an example of using the API to create a val.

gptApiTemplate2 file matches

@charmaineUpdated 2 days ago
mux
Your friendly, neighborhood video API.
api