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=214&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 12939 results for "api"(1251ms)

cerebras_coder

cerebras_coderREADME.md2 matches

@Parvezalam6Updated 2 weeks ago
8
91. Sign up for [Cerebras](https://cloud.cerebras.ai/)
102. Get a Cerebras API Key
113. Save it in your project env variable called `CEREBRAS_API_KEY`
cerebras_coder

cerebras_coderindex.ts1 match

@Parvezalam6Updated 2 weeks ago
211 } catch (error) {
212 Toastify({
213 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
214 position: "center",
215 duration: 3000,
cerebras_coder

cerebras_coderindex.html3 matches

@Parvezalam6Updated 2 weeks 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_coder

cerebras_codergenerate-code.ts1 match

@Parvezalam6Updated 2 weeks 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: [

guidemain.tsx6 matches

@GetUpdated 2 weeks ago
20}
21
22// Defines the specific JSON structure expected back from the OpenAI API
23interface OpenAIResponse {
24 races: RaceInfo[]; // An array containing the race information
26
27// --- Fallback Data ---
28// Provides default race data if the OpenAI API call fails or returns invalid data.
29// This ensures the carousel always has content to display.
30const fallbackRaceData: RaceInfo[] = [
59
60// --- OpenAI Generation Function ---
61// Asynchronously fetches race data from OpenAI's Chat Completion API.
62async function generateRaceDataWithOpenAI(): Promise<RaceInfo[]> {
63 // Initialize the OpenAI client (using API key from Val Town secrets)
64 const openai = new OpenAI();
65
791 <meta name="viewport" content="width=device-width, initial-scale=1.0">
792 <title>Character Creator - Select Race</title>
793 <link rel="preconnect" href="https://fonts.googleapis.com">
794 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
795 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap" rel="stylesheet">
796 <style>
797 /* Embedded CSS styles */

beeminderGoalsDueTodaymain.tsx1 match

@daryaseUpdated 2 weeks ago
10 // Fetch goals with a more detailed request
11 const goalsResponse = await fetch(
12 `https://www.beeminder.com/api/v1/users/me/goals.json?auth_token=${beeminderAuthToken}&datapoints=recent`,
13 );
14

reactHonoStarterindex.ts2 matches

@bradnobleUpdated 2 weeks ago
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
13
14// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
16
17// Unwrap and rethrow Hono errors as the original error

beeminderGoalsDueTodayREADME.md5 matches

@daryaseUpdated 2 weeks ago
10You need both an Intend and a Beeminder account. They're each systems for tracking goals, but [Beeminder is for quantitative &/ hard commitments, and Intend is for qualitative &/ soft commitments](https://blog.beeminder.com/complice/) (Intend was called Complice back when that article was written).
11
121. Get your `auth_token` from Beeminder [here](https://www.beeminder.com/api/v1/auth_token.json).
132. Go [here](https://intend.do/$USERNAME/apps/custom/settings)
143. Enter the following:
21 - PUT completions to: *[leave this blank]*
224. Hit save.
235. Reload your today page, go to enter intentions, and observe that a new button has appeared labelled "Pull from Beeminder"! Push that button and it'll access the Beeminder API via this val.
24
25## How this was created
26
27The main prompt was
28> endpoint that when a GET request hits it with a provided beeminder_auth_token, it hits up the beeminder API (docs at https://api.beeminder.com/) with that auth_token and returns a multiline string that looks like this, one line per goal due today:
29> ```
30> 🐝) +5 pushups by 13:00 for swole
34> (ie "delta needed", "yunits", "deadline", "goalslug")
35
36however it took "delta needed" and "yunits" for granted and those are the wrong variable names... but that was soon fixed by pasting in the "goal definition" section of the Beeminder API for reference. then I added:
37> great. now add a thing where if you add &includeTomorrow=1 then it also includes items due tomorrow, with "due tomorrow at XX:00" in the line
38
42and it just got those right first thing.
43
44fwiw, I'm not 100% certain it actually referenced the beeminder API docs by fetching them from the url I provided, or if it just got it somehow from having seen enough examples.
45
46## Future ideas

politymain.tsx9 matches

@salonUpdated 2 weeks ago
946 let openai: OpenAI;
947 try {
948 // Assumes OPENAI_API_KEY is set as a Val Town secret named 'openai'
949 openai = new OpenAI();
950 // Perform a simple test call or validation if needed, but often just instantiating is enough.
952 logServer("ERROR", "Failed to initialize OpenAI Client", { error: e.message });
953 // If OpenAI fails to init, we can still potentially serve the HTML,
954 // but API calls will fail later. For API calls, we return an immediate error.
955 // We'll handle API call errors within the analysis function.
956 }
957
974 return {
975 success: false,
976 error: "OpenAI client failed to initialize. Check server logs and API key configuration.",
977 };
978 }
1079 logServer("ERROR", "Policy Analysis tool execution failed", { errorMessage: error.message, stack: error.stack });
1080 let specificError = error.message;
1081 // Check for common OpenAI API errors
1082 if (error.status === 401) specificError = "OpenAI Authentication failed. Check API key secret.";
1083 if (error.status === 429) specificError = "OpenAI Rate limit or quota exceeded.";
1084 if (error.status >= 500) specificError = "OpenAI server error. Please try again later.";
1093 const sourceUrl = import.meta.url; // Used for link back in HTML shell
1094
1095 // --- API Request Branch (POST /?format=json) ---
1096 if (req.method === "POST" && format === "json") {
1097 let requestBody: AnalysisRequestPayload;
1100
1101 try {
1102 // --- Check OpenAI init status again specifically for API calls ---
1103 if (!openai) {
1104 throw new Error("OpenAI client is not available. Check server configuration/secrets.");
1148 headers: {
1149 "Content-Type": "application/json",
1150 "Access-Control-Allow-Origin": "*", // Allow CORS for API usage if needed
1151 },
1152 });

faithfulTanEelmain.tsx2 matches

@salonUpdated 2 weeks ago
456 <meta name="viewport" content="width=device-width, initial-scale=1.0">
457 <title>Character Creator - Select Race</title>
458 <link rel="preconnect" href="https://fonts.googleapis.com">
459 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
460 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap" rel="stylesheet">
461 <style>
462 ${css}

vapi-minutes-db1 file match

@henrywilliamsUpdated 1 day ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 2 days 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