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=18&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 20501 results for "api"(5591ms)

phosphor-job-submission

phosphor-job-submissionAGENT.md29 matches

@colelโ€ขUpdated 1 day ago
11- **Framework**: Hono for HTTP routing
12- **Storage**: None (stateless webhook processor)
13- **AI**: OpenAI GPT-4o (preprocessing) + O3 (analysis) with Responses API
14- **Search**: OpenAI native web search (advanced depth, 10 max results)
15- **CRM**: Attio integration for candidate tracking
16
17## Environment Variables (Required)
18- `OPENAI_API_KEY` - OpenAI API key for GPT-4o and O3 models
19- `ATTIO_API_KEY` - Attio CRM API key for candidate record creation
20
21## Environment Variables (Optional)
26
27```
28โ”œโ”€โ”€ clients/ # API client classes
29โ”‚ โ”œโ”€โ”€ types.ts # Shared TypeScript interfaces
30โ”‚ โ”œโ”€โ”€ attio.ts # AttioClient - CRM operations
32โ”œโ”€โ”€ utils/ # Utility classes
33โ”‚ โ”œโ”€โ”€ tokens.ts # TokenEstimator - text/token analysis
34โ”‚ โ””โ”€โ”€ logging.ts # ApiLogger - centralized logging
35โ”œโ”€โ”€ index.ts # Main Hono app (business logic only)
36โ”œโ”€โ”€ job_expectations.ts # Job requirement definitions
58- `processJobApplication()` - Complete AI workflow
59
60## OpenAI Responses API Important Notes
61- Use `max_output_tokens` NOT `max_completion_tokens`
62- o3 model does NOT support `temperature` parameter
63- Web search tool supports `search_depth: "advanced"` and `max_results: 10`
64- Responses API is stateful - can use `previous_response_id` for multi-turn
65- API endpoint: `https://api.openai.com/v1/responses`
66
67## Attio CRM Integration
68- Creates person records: `POST https://api.attio.com/v2/objects/people/records`
69- Adds to recruiting list: `POST https://api.attio.com/v2/lists/{list_id}/entries`
70- Recruiting List ID: `7db6082b-e33a-465f-8387-59bc4df2b9a8`
71- Graceful degradation if Attio API fails
72
73## Data Flow
79 - O3 model performs comprehensive analysis with web search
80 - O3 model generates three candidate response templates (positive/neutral/negative)
815. **CRM Integration**: Attio API โ†’ create person record + add to recruiting list + analysis note
826. **Email Report**: Send technical report with all three templates to recruiter
837. **Output**: Return complete candidate report with AI-recommended template
86- **Header Check**: Reads `framer-webhook-attempt` header from Framer form submissions
87- **Early Return**: Attempts > 1 immediately return HTTP 200 without processing
88- **Resource Efficiency**: Prevents duplicate API calls and database records
89- **Fast Response**: Retry attempts get immediate success response
90
125
126### Client Pattern
127**Use the established client pattern for any new API integrations:**
128
129```typescript
130export class ExampleClient {
131 private readonly apiKey: string;
132 private readonly baseUrl = "https://api.example.com";
133
134 constructor(apiKey?: string) {
135 this.apiKey = apiKey || Deno.env.get('EXAMPLE_API_KEY') || '';
136 if (!this.apiKey) {
137 throw new Error('EXAMPLE_API_KEY is required');
138 }
139 }
150
151### Type Safety
152- **All API interactions** must have TypeScript interfaces in `clients/types.ts`
153- **Export types** for reuse across the codebase
154- **Document with JSDoc** including links to API documentation
155- **Use unknown types** for external API responses, then cast safely
156
157### Error Handling Strategy
158- **Client Level**: Catch and log API errors, re-throw with context
159- **Business Logic**: Let errors bubble up with meaningful messages
160- **HTTP Layer**: Convert to appropriate HTTP status codes
162
163### Logging Standards
164- **Use ApiLogger** for all external API interactions
165- **Include request IDs** and response headers for debugging
166- **Log step progression** for complex workflows
169### Adding New Features
170
171**1. New API Integration:**
172```bash
173# 1. Add types to clients/types.ts
181# 1. Keep in index.ts if simple HTTP handling
182# 2. Extract to utils/ if reusable utility
183# 3. Create new client if external API interaction
184# 4. Always add TypeScript interfaces
185```
208
209## File Organization Rules
210- **clients/**: API client classes only
211- **utils/**: Reusable utility classes
212- **types.ts**: All TypeScript interfaces
219- **Each client method** should be testable in isolation
220- **Use dependency injection** for testability
221- **Mock external APIs** in tests, never hit real endpoints
222

IsItTwoWordsindex.ts2 matches

@alexweinโ€ขUpdated 1 day ago
13app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
14
15// Add your API routes here
16app.get("/api/wordlist", c => c.json(wordlist));
17
18// Unwrap and rethrow Hono errors as the original error

houseCommitteeMeetingQuickCheckmain.js3 matches

@blackerbyโ€ขUpdated 1 day ago
10const meetings = [];
11for (const meeting of meetingRows) {
12 const [event_id, cdg_api_url_json, cdg_json_status, cdg_api_url_xml, cdg_xml_status, cdg_url, house_repo_url] =
13 meeting;
14 meetings.push({
15 event_id: event_id,
16 cdg_api_url_json: cdg_api_url_json,
17 cdg_json_status: cdg_json_status,
18 cdg_api_url_xml: cdg_api_url_xml,
19 cdg_xml_status: cdg_xml_status,
20 cdg_url: cdg_url,

untitled-256main.tsx6 matches

@joinโ€ขUpdated 1 day ago
49 <meta name="viewport" content="width=device-width, initial-scale=1.0">
50 <title>BrandCraft AI</title>
51 <link rel="preconnect" href="https://fonts.googleapis.com">
52 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
53 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
54<style>
55 :root {
239<script>
240(function() {
241 const API_URL = '${sourceUrl}';
242
243 // --- DOM Elements ---
365
366 try {
367 const response = await fetch(API_URL, {
368 method: 'POST',
369 headers: { 'Content-Type': 'application/json' },
404 if (req.method === "POST") {
405 try {
406 // Initialize OpenAI with the API key from environment variables
407 const openai = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") });
408 const body = await req.json();
409 const { name, description } = body;

musemain.tsx2 matches

@joinโ€ขUpdated 1 day ago
193 <title>AI-Curated Glassmorphism Showcase</title>
194 <script src="https://cdn.tailwindcss.com"></script>
195 <link rel="preconnect" href="https://fonts.googleapis.com">
196 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
197 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
198 <style>
199 body {

accelerometermain.tsx6 matches

@joinโ€ขUpdated 1 day ago
38 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
39 <title>Tiltscape</title>
40 <link rel="preconnect" href="https://fonts.googleapis.com">
41 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
42 <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Roboto+Mono:wght@400;700&display=swap" rel="stylesheet">
43 <style>
44 :root {
172 <script>
173 (function() {
174 const API_URL = '${sourceUrl}';
175 const canvas = document.getElementById('game-canvas');
176 const ctx = canvas.getContext('2d');
230
231 try {
232 const response = await fetch(\`\${API_URL}?action=generatePattern\`, {
233 method: 'POST',
234 headers: { 'Content-Type': 'application/json' },
241
242 if (!response.ok) {
243 throw new Error(\`API Error: \${response.statusText}\`);
244 }
245
430 const action = url.searchParams.get("action");
431
432 // Handle API requests
433 if (req.method === "POST" && action === "generatePattern") {
434 try {

untitled-2007main.tsx4 matches

@joinโ€ขUpdated 1 day ago
59 <meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">
60 <title>???</title>
61 <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
62 <link href="https://fonts.googleapis.com/css2?family=VT323&family=Major+Mono+Display&display=swap" rel="stylesheet">
63<style>
64 :root { --bg-color:#010008; --glow-color:#7b2cbf; --text-color:#cc99ff; --lcd-bg:rgba(20,5,40,0.2); --scanline-color:rgba(123,44,191,0.1); --particle-color:#a442f1; --horror-text-color:#FF3131; --horror-glow-color:#990000; }
91<script>
92(function() {
93 const API_URL = '${sourceUrl}';
94 const G = { body:document.body, marquee:document.getElementById('marquee-wrapper'), text:document.getElementById('text-wrapper'), shadow:document.getElementById('shadow-text'), prompt:document.getElementById('prompt'), timer:document.getElementById('timer'), cursor:document.getElementById('magic-cursor'), canvas:document.getElementById('particle-canvas') };
95 const C = { NUM_SEGMENTS:70, ARC_DEGREES:170, RADIUS:350 };
108 function endGame(escaped){clearInterval(S.gameTimer);G.timer.style.display='none';S.userInput='';S.gameState=escaped?'escaped':'trapped';G.body.className=escaped?'':'horror-stage-2';playHorrorSound(escaped?0:3);renderText([escaped?'SYSTEM:: ESCAPE COMPLETE':'SYSTEM:: CONNECTION TERMINATED']);G.prompt.textContent=escaped?'You are free... for now.':'You belong to the machine.';if(!escaped)triggerGlitch(true)}
109 function startChallenge(challenge){S.gameState=\`challenge_\${challenge.challenge_type}\`;S.currentChallenge=challenge;S.userInput='';let timeLeft=challenge.duration_ms;G.timer.style.display='block';renderText([challenge.instructions,challenge.sequence||''],{center:false});S.gameTimer=setInterval(()=>{timeLeft-=100;G.timer.textContent=(timeLeft/1000).toFixed(1);if(timeLeft<=0)endGame(false)},100)}
110 async function submitToAI(stageOverride=null){if(S.gameState.includes('challenge')&&!stageOverride)return;G.prompt.textContent='...';let stage='stage_'+S.turnCount;if(S.turnCount>=3)stage='game_challenge_1';if(stageOverride)stage=stageOverride;try{const res=await fetch(API_URL,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({stage,user_input:S.userInput})});if(!res.ok)throw new Error('NO RESPONSE');const data=await res.json();S.userInput='';if(data.responses){S.turnCount++;G.body.className=\`horror-stage-\${S.turnCount>2?2:S.turnCount}\`;playHorrorSound(S.turnCount);S.responseQueue=data.responses;triggerGlitch();showNextQueuedResponse()}else if(data.challenge_type){startChallenge(data)}else{throw new Error('INVALID PAYLOAD')}}catch(err){renderText(['// ERROR //',err.message])}}
111 function handleGameInput(key){if(S.gameState==='challenge_sequence'){if(key==='Backspace')S.userInput=S.userInput.slice(0,-1);else if(key.length===1&&S.userInput.length<S.currentChallenge.sequence.length)S.userInput+=key;renderText([S.currentChallenge.instructions,S.currentChallenge.sequence,S.userInput],{center:false,showCursor:true});if(S.userInput===S.currentChallenge.sequence){clearInterval(S.gameTimer);G.timer.style.display='none';renderText(['SEQUENCE ACCEPTED']);setTimeout(()=>submitToAI('game_challenge_2'),2000)}}}
112 window.addEventListener('keydown',e=>{if(['escaped','trapped'].includes(S.gameState))return;initAudio();if(S.gameState==='chatting'){G.prompt.textContent='Press Enter.';if(e.key==='Enter'){if(S.userInput.length>0)submitToAI()}else if(e.key==='Backspace')S.userInput=S.userInput.slice(0,-1);else if(e.key.length===1&&S.userInput.length<40)S.userInput+=e.key;renderText([S.userInput],{showCursor:true})}else{handleGameInput(e.key)}});

untitled-415main.tsx4 matches

@joinโ€ขUpdated 1 day ago
45 <meta name="viewport" content="width=device-width, initial-scale=1.0">
46 <title>Whispering Marquee</title>
47 <link rel="preconnect" href="https://fonts.googleapis.com">
48 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
49 <link href="https://fonts.googleapis.com/css2?family=VT323&family=Major+Mono+Display&display=swap" rel="stylesheet">
50<style>
51 :root {
226<script>
227(function() {
228 const API_URL = '${sourceUrl}';
229
230 const marqueeWrapper = document.getElementById('marquee-wrapper');
405 renderText(['...']);
406 try {
407 const response = await fetch(API_URL, {
408 method: 'POST',
409 headers: { 'Content-Type': 'application/json' },

openaimain.tsx7 matches

@wangqiao1234โ€ขUpdated 1 day ago
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });

openaiREADME.md3 matches

@wangqiao1234โ€ขUpdated 1 day ago
1# OpenAI - [Docs โ†—](https://docs.val.town/std/openai)
2
3Use OpenAI's chat completion API with [`std/openai`](https://www.val.town/v/std/openai). This integration enables access to OpenAI's language models without needing to acquire API keys.
4
5For free Val Town users, [all calls are sent to `gpt-4o-mini`](https://www.val.town/v/std/openaiproxy?v=12#L85).
65If these limits are too low, let us know! You can also get around the limitation by using your own keys:
66
671. Create your own API key on [OpenAI's website](https://platform.openai.com/api-keys)
682. Create an [environment variable](https://www.val.town/settings/environment-variables?adding=true) named `OPENAI_API_KEY`
693. Use the `OpenAI` client from `npm:openai`:
70

claude-api1 file match

@ziyanwouldโ€ขUpdated 40 mins ago

api-workshop

@danarddanielsjrโ€ขUpdated 1 day ago
replicate
Run AI with an API
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of ๐Ÿชฟ HONC ๐Ÿชฟ (https://honc.dev)