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%22Optional%20title%22?q=api&page=136&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 13941 results for "api"(1306ms)

sa_pro1prompt-expander.ts1 match

@pro3•Updated 5 days ago
200 const url = new URL(req.url);
201
202 // Handle the expand API endpoint
203 if (url.pathname === "/expand") {
204 if (req.method !== "POST") {

NPLLMhono.ts3 matches

@wolf•Updated 5 days ago
3import { hc } from "https://esm.sh/hono@4.7.7/client?deps=hono@4.7.7";
4import { QueryClient } from "https://esm.sh/@tanstack/react-query@5.74.7?deps=react@19.0.0";
5import { AppType } from "../backend/api/mod.ts";
6import { APP_URL } from "../shared/consts.ts";
7
8export const client = hc<AppType>(
9 typeof window !== "undefined"
10 ? window.location.origin + "/api"
11 : APP_URL + "/api",
12 { init: { credentials: "include" } },
13);

sa_proREADME.md2 matches

@pro3•Updated 5 days ago
7- Expands even single-word prompts into rich, detailed content
8- Simple, clean user interface with example suggestions
9- Real-time prompt expansion using OpenAI's API
10- Responsive design that works on mobile and desktop
11- Error handling and loading states
46## Notes
47
48This application uses the OpenAI API which requires an API key. Make sure your Val Town account has an OpenAI API key configured in the environment variables.

sa_proprompt-expander.ts3 matches

@pro3•Updated 5 days ago
2
3export default async function (req: Request): Promise<Response> {
4 // Handle API requests for prompt expansion
5 if (req.url.includes("/api/expand") && req.method === "POST") {
6 try {
7 const { prompt } = await req.json();
199
200 try {
201 const response = await fetch('/api/expand', {
202 method: 'POST',
203 headers: {

sa_pro3README.md4 matches

@pro3•Updated 5 days ago
37
38- Built as an HTTP-triggered Val in Val Town
39- Uses OpenAI's API to generate prompts
40- Frontend styled with TailwindCSS
41- Handles both GET and POST requests in a single endpoint
42- Includes error handling for API failures
43
44## Setup
46To use this application, you need to:
47
481. Set up an OpenAI API key as an environment variable in Val Town
492. Deploy the Val with HTTP trigger enabled
50
51## Environment Variables
52
53- `OPENAI_API_KEY`: Your OpenAI API key for generating prompts
54
55## Customization

untitled-8834index.ts5 matches

@hend_elsaeidy•Updated 5 days ago
7
8export default async function(req: Request): Promise<Response> {
9 // Handle API requests for promo code generation
10 if (req.url.includes('/api/generate-promo')) {
11 return handlePromoGeneration(req);
12 }
21
22/**
23 * Handles the API request to generate a promo code
24 */
25async function handlePromoGeneration(req: Request): Promise<Response> {
214 generateBtn.textContent = 'Generating...';
215
216 // Call the API to generate promo code
217 const response = await fetch('/api/generate-promo', {
218 method: 'POST',
219 headers: {

NPLLMenv.ts1 match

@wolf•Updated 5 days ago
2
3export const env = safeEnv({
4 GOOGLE_GENERATIVE_AI_API_KEY: string(),
5});
6

vapi-minutes-dbupdateMinutes.ts2 matches

@henrywilliams•Updated 5 days ago
3const PH_HOST = Deno.env.get("PH_HOST")!;
4const PH_PROJECT_ID = Deno.env.get("PH_PROJECT_ID")!;
5const PH_KEY = Deno.env.get("PH_PERSONAL_API_KEY")!;
6
7const headers = {
43
44 const res = await fetch(
45 `${PH_HOST}/api/projects/${PH_PROJECT_ID}/query/`, // Queries endpoint
46 { method: "POST", headers, body: JSON.stringify(body) },
47 );
sqwnie

sqwniescratch.tsx2 matches

@maxm•Updated 5 days ago
9import { thinkTool } from "./tools/think.tsx";
10
11const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
12
13const anthropic = createAnthropic({
14 apiKey,
15});
16
requests-in-space

requests-in-spaceend.tsx1 match

@shouser•Updated 5 days ago
17 console.log("Message:", decodeURIComponent(message));
18
19 // Make the OpenAI API call
20 const completion = await openai.chat.completions.create({
21 messages: [

new-val-api-demo

@shouser•Updated 21 hours ago
This is an example of using the API to create a val.

groq-api2 file matches

@cameronpak•Updated 1 day ago
snartapi
mux
Your friendly, neighborhood video API.