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/$1?q=api&page=1477&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 17842 results for "api"(7030ms)

openAiProxymain.tsx1 match

@ashryanio•Updated 11 months ago
10export default async function(req: Request): Promise<Response> {
11 // Handle POST request
12 // This is the primary path for the API
13 if (req.method === "POST") {
14 const { prompt } = await req.json();

openAiProxyREADME.md2 matches

@ashryanio•Updated 11 months ago
3## Overview
4
5This val is a proxy server that interacts with the OpenAI API to generate responses based on prompts in the request body. The function handles incoming HTTP POST requests, processes the prompt, and returns a response generated by the LLM.
6
7## Prerequisites
8
9- Server-side: (Optional) An active OpenAI API key
10- Client-side: Something that can make POST requests (browser code, Postman, cURL, another Val, etc)
11

discordBotmain.tsx1 match

@dglazkov•Updated 11 months ago
96 const data = await response;
97 const update = await fetch(
98 `https://discord.com/api/v10/webhooks/${body.application_id}/${body.token}/messages/@original`,
99 {
100 method: "PATCH",

serve_readmemain.tsx2 matches

@cooka•Updated 11 months ago
1import { api } from "https://esm.town/v/pomdtr/api";
2import { gfm } from "https://esm.town/v/pomdtr/gfm";
3import { callerRef } from "https://esm.town/v/pomdtr/refs";
11 title = `@${val.author}/${val.name}`;
12 }
13 const { readme = "" } = await api(`/v1/alias/${val.author}/${val.name}`);
14 return readme;
15}

blackLobstermain.tsx3 matches

@boson•Updated 11 months ago
15
16// Takoma Park, MD weather forecast
17// https://weather-gov.github.io/api/gridpoints
18const NOAA_URL_TKPK = "https://api.weather.gov/gridpoints/LWX/97,75/forecast/hourly";
19
20interface Period {
52}
53
54// Sleep a random amount of seconds (to respect NOAA's API).
55async function sleepRand(seconds: number) {
56 const s = Math.random() * seconds * 1000;

smallwebDashboardmain.tsx1 match

@pomdtr•Updated 11 months ago
47 <div class="flex flex-col items-center bg-white bg-opacity-80 p-4 rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-200">
48 <img
49 src={`https://api.dicebear.com/9.x/identicon/svg?seed=${app}`}
50 alt={app}
51 class="w-24 h-24 object-cover rounded-lg mb-2"

cronLoggermain.tsx2 matches

@nbbaier•Updated 11 months ago
1import { inTheBackground } from "https://esm.town/v/neverstew/inTheBackground";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=6";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=45";
26 headers["Authorization"] = `Bearer ${token}`;
27 }
28 const { id } = await fetchJSON(`${API_URL}/v1/alias/${userHandle}/${valName}`, { headers });
29
30 const table_name = "cron_evals";

weather_forecast_in_the_morningmain.tsx2 matches

@benrobo•Updated 11 months ago
79const fetchForecast = async () => {
80 const response = await fetch(
81 `https://api.openweathermap.org/data/2.5/forecast?lat=${latitude}&lon=${longitude}&units=metric&appid=${openWeatherMapAppId}`,
82 );
83 const data = await response.json();
103const sendTextWithTelegram = async (text: string) => {
104 const telegramSendUrl =
105 `https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage?chat_id=${TELEGRAM_CHAT_ID}&parse_mode=HTML&disable_notification=true&text=${text}`;
106 await fetch(telegramSendUrl);
107};

private_fal_modelmain.tsx1 match

@turbo1912•Updated 11 months ago
7 const result = await fal.subscribe("turbo1912/multiple-models/esrgan", {
8 input: {
9 image_url: "https://storage.googleapis.com/falserverless/gallery/NOCA_Mick-Thompson.resized.resized.jpg",
10 },
11 logs: true,

valTownToSQLitemain.tsx1 match

@pomdtr•Updated 11 months ago
60 await driver.execute(createQuery(table));
61 const query = "export import ); \";"
62 let url = `https://api.val.town/v1/search/vals?query=${encodeURIComponent(query)}&limit=100`;
63 while (true) {
64 const resp = await fetch(url);

dailyQuoteAPI

@Souky•Updated 18 hours ago

HTTP

@Ncharity•Updated 20 hours ago
Daily Quote API
apiry
Kapil01