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/$2?q=api&page=1444&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 17512 results for "api"(8142ms)

googleGenerativeAIStreamingExamplemain.tsx1 match

@tr3ntg•Updated 10 months ago
1import { GoogleGenerativeAI } from "npm:@google/generative-ai";
2export default async function(req: Request): Promise<Response> {
3 const genAI = new GoogleGenerativeAI(Deno.env.get("your-api-key"));
4 const generativeModel = genAI.getGenerativeModel({
5 model: "gemini-1.5-flash-001",

googleGenerativeAIStreamingExampleREADME.md1 match

@tr3ntg•Updated 10 months ago
5**Prerequisite:**
6
7Follow Google's [Getting Started guide](https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=node) to get an API key and view some example methods.
8
9Migrated from folder: Utilities/googleGenerativeAIStreamingExample

servicefactorymain.tsx2 matches

@dglazkov•Updated 11 months ago
62 * Indicates that the input or output port represents base structured
63 * datatype containing multi-part content of a message, generated by an LLM.
64 * See [Content](https://ai.google.dev/api/rest/v1beta/Content) for details
65 * on the datatype.
66 */
242 if (!inputs.$key || inputs.$key != Deno.env.get("BB_SERVICE_KEY")) {
243 return Response.json({
244 $error: "Must provide an API key to access the service.",
245 });
246 }

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";

RandomQuoteAPI

@Freelzy•Updated 17 hours ago

HAPI7 file matches

@dIgitalfulus•Updated 22 hours ago
Kapil01
apiv1