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%20%22Image%20title%22?q=api&page=116&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 13304 results for "api"(3281ms)

sqliteExplorerAppmain.tsx2 matches

@tobybaggioUpdated 4 days 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 />

plantymain.tsx26 matches

@jonboUpdated 4 days ago
153 setIsLoading(true);
154 try {
155 const response = await fetch(`/api/${syncId}/last-watered`);
156 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
157 const data = await response.json();
240 if (!syncId) return;
241 try {
242 const response = await fetch(`/api/${syncId}/waterers`);
243 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
244 const data = await response.json();
253 if (!syncId) return;
254 try {
255 const response = await fetch(`/api/${syncId}/history`);
256 if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
257 const data = await response.json();
312
313 try {
314 await fetch(`/api/${syncId}/water`, {
315 method: "POST",
316 headers: { "Content-Type": "application/json" },
323 if (newWatererName.trim() && !selectedWaterer) {
324 // Add the new waterer to the list
325 await fetch(`/api/${syncId}/waterers`, {
326 method: "POST",
327 headers: { "Content-Type": "application/json" },
481 try {
482 const [waterersResponse, historyResponse] = await Promise.all([
483 fetch(`/api/${syncId}/waterers`),
484 fetch(`/api/${syncId}/history`),
485 ]);
486 if (!waterersResponse.ok) throw new Error(`Waterers fetch error! status: ${waterersResponse.status}`);
510 setIsProcessing(true);
511 try {
512 await fetch(`/api/${syncId}/history/${entryId}`, { method: "DELETE" });
513 fetchDataInternal(); // Refresh
514 } catch (error) {
678 setIsProcessing(true);
679 try {
680 const waterersResponse = await fetch(`/api/${syncId}/waterers`);
681 if (!waterersResponse.ok) throw new Error(`Waterers fetch error! status: ${waterersResponse.status}`);
682
699 setIsProcessing(true);
700 try {
701 const response = await fetch(`/api/${syncId}/waterers`, {
702 method: "POST",
703 headers: { "Content-Type": "application/json" },
723 setIsProcessing(true);
724 try {
725 await fetch(`/api/${syncId}/waterers/${watererId}`, {
726 method: "PUT",
727 headers: { "Content-Type": "application/json" },
742 setIsProcessing(true);
743 try {
744 await fetch(`/api/${syncId}/waterers/${watererId}`, { method: "DELETE" });
745 fetchWaterersInternal(); // Refresh
746 } catch (error) {
1065
1066 const url = new URL(request.url);
1067 // Path parts: e.g., ["api", "your-sync-id", "waterers", "waterer-item-id"]
1068 const pathParts = url.pathname.split("/").filter(p => p.trim() !== "");
1069
1070 if (pathParts[0] === "api" && pathParts.length >= 2) {
1071 const syncId = pathParts[1];
1072 const apiResource = pathParts.length > 2 ? pathParts[2] : null; // e.g., "waterers", "history", "water", "last-watered"
1073 const itemId = pathParts.length > 3 ? pathParts[3] : null; // e.g., a specific watererId or historyEntryId
1074
1111 }
1112
1113 // --- API Route Handlers ---
1114
1115 // Waterers: /api/:syncId/waterers
1116 if (apiResource === "waterers") {
1117 let instanceData = await getInstanceData(syncId);
1118 if (request.method === "GET" && !itemId) {
1167 }
1168 }
1169 // History: /api/:syncId/history
1170 else if (apiResource === "history") {
1171 let instanceData = await getInstanceData(syncId);
1172 if (request.method === "GET" && !itemId) {
1192 }
1193 }
1194 // Water Action: /api/:syncId/water
1195 else if (apiResource === "water" && request.method === "POST") {
1196 const { waterer, notes } = await request.json(); // Added notes parameter
1197 if (!waterer || typeof waterer !== "string") {
1217 });
1218 }
1219 // Last Watered: /api/:syncId/last-watered
1220 else if (apiResource === "last-watered" && request.method === "GET") {
1221 const instanceData = await getInstanceData(syncId);
1222 return new Response(JSON.stringify({ lastWatered: instanceData.last_watered_timestamp }), {
1225 }
1226 // Optional: Endpoint to generate a new sync ID
1227 // else if (pathParts[0] === 'api' && pathParts[1] === 'generate-sync-id' && request.method === 'GET') {
1228 // const newSyncId = `sync_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
1229 // return new Response(JSON.stringify({ syncId: newSyncId }), { headers: { 'Content-Type': 'application/json' } });
1230 // }
1231
1232 return new Response(JSON.stringify({ error: "API endpoint not found or method not allowed." }), {
1233 status: 404,
1234 headers: { "Content-Type": "application/json" },
1CEREBRAS_API_KEYcsk-phjx2jjh89eptw4854x28wjfemdkedr38f5nw4n66pw5ffdd
12 },
13 {
14 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
15 "title": "Weather App",
16 "code":

cerebras_coder-BELLOYARONREADME.md2 matches

@BELLOYARONUpdated 4 days 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`
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,
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
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: [

acme-customsindex.tsx56 matches

@yawnxyzUpdated 4 days ago
1import "jsr:@std/dotenv/load"; // needed for deno run; not req for smallweb or valtown
2import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
3// No streamSSE needed for client-side only VAPI handling
4// import { streamSSE } from "https://deno.land/x/hono@v3.11.7/helper/streaming/index.ts";
5import Groq from "npm:groq-sdk";
7const app = new Hono();
8
9const groq = new Groq({ apiKey: Deno.env.get("GROQ_API_KEY") });
10
11// Add a simple in-memory rate limiter (per IP)
12const extractDataRateLimit = new Map();
13
14// Define the VAPI browser code as a string that will be injected
15const vapiCode = `
16// Create a simple EventEmitter implementation
17class EventEmitter {
48}
49
50// VapiEventEmitter extends our custom EventEmitter
51class VapiEventEmitter extends EventEmitter {
52 constructor() {
53 super();
55}
56
57// Main Vapi class
58class Vapi extends VapiEventEmitter {
59 constructor(apiKey, baseUrl = "https://api.vapi.ai", callConfig = {}, callObject = {}) {
60 super();
61 this.apiKey = apiKey;
62 this.baseUrl = baseUrl;
63 this.started = false;
71 method: 'POST',
72 headers: {
73 'Authorization': \`Bearer \${this.apiKey}\`,
74 'Content-Type': 'application/json',
75 },
109
110 try {
111 // 1. Get the room URL from VAPI API
112 const callData = await this.createWebCall({
113 assistantId: assistantId,
115 });
116
117 console.log('VAPI_DEBUG: Call data:', callData);
118 console.log('VAPI_DEBUG: webCallUrl:', callData.webCallUrl);
119
120 if (this.call) this.cleanup();
125
126 // Create a function that will be run in the global context
127 const joinVapiRoom = (url) => {
128 return new Promise((resolve, reject) => {
129 try {
166 // Run the isolated function and get back the call object
167 try {
168 this.call = await joinVapiRoom(callData.webCallUrl);
169
170 // If we get here, the join was successful
176 return callData;
177 } catch (error) {
178 console.error('VAPI_DEBUG: Isolated join failed', error);
179 this.emit('error', error);
180 this.cleanup();
216 if (!event || !event.participant) return;
217
218 if (!event.participant.local && event.participant.user_name === 'Vapi Speaker') {
219 if (event.track.kind === 'video') {
220 this.emit('video', event.track);
286}
287
288// Make Vapi available globally
289window.Vapi = Vapi;
290`;
291
302 <meta property="twitter:image" content="https://f2.phage.directory/capsid/64WqJMHP/acme-customs.png">
303 <!-- Fonts -->
304 <link rel="preconnect" href="https://fonts.googleapis.com">
305 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
306 <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600&display=swap" rel="stylesheet">
307 <!-- Alpine.js -->
308 <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
309 <!-- VAPI dependencies -->
310 <script src="https://cdn.jsdelivr.net/npm/@daily-co/daily-js@0.79.0/dist/daily.min.js"></script>
311 <script>${vapiCode}</script>
312
313 <style>
905 </style>
906</head>
907<body x-data="vapiCustomsDemo">
908 <div class="main-container">
909 <div class="cyber-marquee-top-wrapper">
1004 <span class="micro-header">ACME CYBERNETICS // PROTOCOL OMEGA // SECTOR 7G</span>
1005 <div class="footer-text">ACME Customs © 2024 // Advanced Cybernetic Modification Engineering</div>
1006 <div class="footer-text">Powered by <a href="https://groq.com" target="_blank">Groq</a> and <a href="https://vapi.ai" target="_blank">Vapi</a>. <a href="https://www.val.town/x/yawnxyz/acme-customs" target="_blank">Source code</a></div>
1007 </footer>
1008
1010 // Define the Alpine.js component
1011 document.addEventListener('alpine:init', () => {
1012 Alpine.data('vapiCustomsDemo', () => ({
1013 vapi: null,
1014 callStatus: 'idle', // idle, connecting, started, ended
1015 assistantIsSpeaking: false,
1018 transcriptText: 'Awaiting connection... Stand by for vehicle consultation.',
1019 extractedData: {}, // generic extracted data object
1020 vapiPublicKey: '872dea2d-4afc-4ab4-b871-5797fdb1397e',
1021 assistantId: '458bb70e-cc52-4122-9f3d-b260a6220830',
1022
1023 init() {
1024 if (typeof window.Vapi === 'undefined') {
1025 console.error('VAPI SDK not loaded. Ensure VAPI script is included and loaded.');
1026 alert('Critical system error: VAPI SDK failed to initialize.');
1027 return;
1028 }
1029
1030 try {
1031 this.vapi = new window.Vapi(this.vapiPublicKey);
1032 this.setupVapiEventHandlers();
1033 console.log('VAPI System Initialized. Standby.');
1034 this.extractedData = {};
1035 } catch (error) {
1036 console.error('Error initializing Vapi:', error);
1037 alert('VAPI initialization failed: ' + error.message);
1038 }
1039 },
1040
1041 setupVapiEventHandlers() {
1042 if (!this.vapi) return;
1043
1044 this.vapi.on('call-start', () => {
1045 console.log('Call initiated.');
1046 this.callStatus = 'started';
1049 });
1050
1051 this.vapi.on('call-end', () => {
1052 console.log('Call terminated.');
1053 this.callStatus = 'ended';
1056 });
1057
1058 this.vapi.on('speech-start', () => { // Assistant speech
1059 // console.log('Assistant speech started');
1060 this.assistantIsSpeaking = true;
1061 });
1062
1063 this.vapi.on('speech-end', () => { // Assistant speech
1064 // console.log('Assistant speech ended');
1065 this.assistantIsSpeaking = false;
1066 });
1067
1068 this.vapi.on('user-speech-start', () => {
1069 this.userIsSpeaking = true;
1070 });
1071
1072 this.vapi.on('user-speech-end', () => {
1073 this.userIsSpeaking = false;
1074 });
1075
1076
1077 this.vapi.on('message', (msg) => {
1078 // console.log('Message received:', msg);
1079 if (msg.type === 'transcript') {
1103 });
1104
1105 this.vapi.on('error', (error) => {
1106 console.error('VAPI Error:', error);
1107 this.callStatus = 'idle'; // Reset status on error
1108 alert('An error occurred during the call: ' + error.message);
1144
1145 async startCall() {
1146 if (!this.vapi) {
1147 alert('VAPI system not ready. Please wait or refresh.');
1148 return;
1149 }
1154 try {
1155 // console.log('Attempting to start call with assistant ID:', this.assistantId);
1156 await this.vapi.start(this.assistantId);
1157 // call-start event will set status to 'started'
1158 } catch (error) {
1164
1165 async stopCall() {
1166 if (!this.vapi || this.callStatus === 'ended' || this.callStatus === 'idle') return;
1167 try {
1168 // console.log('Attempting to stop call.');
1169 await this.vapi.stop();
1170 // call-end event will set status to 'ended' and then we can set to idle
1171 // Forcing idle here to make button state reflect stopping action immediately
1209});
1210
1211// Add a route to serve the vapi-browser.js file
1212app.get('/vapi-browser.js', async (c) => {
1213 return c.text(await Deno.readTextFile('./vapi-browser.js'), {
1214 headers: {
1215 'Content-Type': 'application/javascript',
12 },
13 {
14 "prompt": "weather dashboard for nyc using open-meteo API for NYC with icons",
15 "title": "Weather App",
16 "code":

vapi-minutes-db1 file match

@henrywilliamsUpdated 3 days ago

vapi-minutes-db2 file matches

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