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=29&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 12898 results for "api"(1012ms)

1import { email } from "https://esm.town/v/std/email?v=13";
2import { sqlite } from "https://esm.town/v/std/sqlite2?v=1";
3import { AtpAgent, AtpSessionData, AtpSessionEvent } from "npm:@atproto/api";
4import diff from "npm:fast-diff@1.3.0";
5
26
27 // Supports up to 5,000 (100*50) follows, stopping there to try
28 // and avoid rate limits. These APIs have pretty low limits, sound off here
29 // https://github.com/bluesky-social/atproto/discussions/3356
30 outerLoop: for (let i = 0; i < 20; i++) {

bluesky-thinkup-tributeREADME.md2 matches

@capndesignUpdated 1 day ago
18I was an avid user of [ThinkUp](https://www.thinkupapp.com/), a tool that connected to Twitter and sent me a daily email with profile updates from all the people I followed. I found it useful in work and for fun. Maybe one of my friends switched jobs or changed their username to something goofy or political. I want to know! In the distant past Facebook would include profile updates in the newsfeed: why not that for Twitter? ThinkUp did some other cool stuff, like providing full archives of Tweets in a more convenient format than Twitter did themselves.
19
20But Twitter [is bad now](https://macwright.com/2025/03/04/twitter-eol) and ThinkUp [shut down in 2016](https://www.thinkupapp.com/) because [the APIs that they were relying on from Twitter, Facebook, and Instagram were all locked down and limited](https://medium.com/@anildash/the-end-of-thinkup-e600bc46cc56). How disappointing.
21
22But there's a new social network in town, [Bluesky](https://bsky.app/), and it's ~~impossible~~ somewhat more difficult to corrupt and enshittify than those networks were, and it comes with a pretty good, if sometimes weird API that gives you access to everything you need.
23
24Could you build some of ThinkUp on Bluesky? Yes. This is it.

aatest-openai.ts9 matches

@msdUpdated 1 day ago
2
3/**
4 * Simple test to verify OpenAI API key is working
5 */
6export default async function(): Promise<Response> {
7 try {
8 // Check for OpenAI API key
9 const apiKey = Deno.env.get("OPENAI_API_KEY");
10 if (!apiKey) {
11 return new Response(JSON.stringify({
12 error: "OpenAI API key is missing",
13 message: "Please set the OPENAI_API_KEY environment variable in Val Town."
14 }), {
15 status: 500,
18 }
19
20 // Test OpenAI API
21 const openai = new OpenAI();
22 const completion = await openai.chat.completions.create({
30 return new Response(JSON.stringify({
31 success: true,
32 message: "OpenAI API key is working correctly",
33 response: completion.choices[0].message.content
34 }), {
37 } catch (error) {
38 return new Response(JSON.stringify({
39 error: "OpenAI API test failed",
40 message: error.message || "Unknown error"
41 }), {

aaREADME.md9 matches

@msdUpdated 1 day ago
13
14- `/course-generator.ts` - Core logic for generating course structures using OpenAI
15- `/frontend-handler.ts` - HTTP handler that serves the frontend and processes API requests
16- `/frontend/index.html` - Web interface for the course generator
17
254. View the generated course structure with modules and lessons
26
27### API Usage
28
29You can also use the course generator as an API:
30
31```javascript
32// Example API call
33const response = await fetch('YOUR_VAL_TOWN_URL', {
34 method: 'POST',
44## Response Format
45
46The API returns a JSON object with the following structure:
47
48```json
73## Requirements
74
75- OpenAI API key set as an environment variable in Val Town
76
77## Setup Instructions
78
791. In Val Town, go to your account settings
802. Add an environment variable named `OPENAI_API_KEY` with your OpenAI API key
813. Deploy both the course-generator.ts and frontend-handler.ts files with HTTP triggers
82
85If the application isn't generating any responses, check the following:
86
871. **OpenAI API Key**: Make sure you've set the `OPENAI_API_KEY` environment variable in Val Town
882. **Console Logs**: Check the Val Town logs for any error messages
893. **Browser Console**: Open your browser's developer tools to check for any JavaScript errors
904. **API Limits**: If you're using a free OpenAI API key, you might have hit your usage limits

aacourse-generator.ts5 matches

@msdUpdated 1 day ago
27 */
28export async function generateCourseStructure(prompt: string): Promise<CourseStructure> {
29 // Check for OpenAI API key
30 const apiKey = Deno.env.get("OPENAI_API_KEY");
31 if (!apiKey) {
32 console.error("OpenAI API key is missing. Please set the OPENAI_API_KEY environment variable in Val Town.");
33 throw new Error("OpenAI API key is missing. Please set the OPENAI_API_KEY environment variable in Val Town.");
34 }
35
16│ ├── index.ts # Main entry point with Hono setup
17│ └── routes/
18│ └── highlighter-route.ts # Highlighter API route
19├── frontend/
20│ ├── components/
37## Usage
38
39Visit the frontend page to customize and generate syntax-highlighted images. The API endpoint is available at `/api/highlighter` with the following parameters:
40
41- `code`: The code to highlight
12});
13
14// API routes
15app.get("/api/highlighter", highlighterHandler);
16
17// Serve static files

Towniesystem_prompt.txt10 matches

@valdottownUpdated 1 day ago
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
24
25- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
167However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
168If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
169or by making an API request for it.
170
171## Val Town Platform Specifics
175- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
176- **Storage:** DO NOT use the Deno KV module for storage
177- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
178- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
179- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
180- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
181- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
182- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
183- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
184- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
218### Backend (Hono) Best Practices
219
220- Hono is the recommended API framework
221- Main entry point should be `backend/index.ts`
222- Do NOT use Hono serveStatic middleware
243 });
244 ```
245- Create RESTful API routes for CRUD operations
246- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
247 ```ts
280 - For files in the project, use `readFile` helpers
281
2825. **API Design:**
283 - `fetch` handler is the entry point for HTTP vals
284 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
16): string {
17 return (
18 `${baseUrl}/api/highlighter?code=` +
19 encodeURIComponent(code) +
20 '&background=' +

JobChatApptypes.ts2 matches

@cipherUpdated 1 day ago
19}
20
21// API response interfaces
22export interface ApiResponse<T> {
23 success: boolean;
24 data?: T;

vapi-minutes-db1 file match

@henrywilliamsUpdated 1 day ago

vapi-minutes-db2 file matches

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