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=966&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 13428 results for "api"(2046ms)

tvshowsmain.tsx2 matches

@tmcw•Updated 7 months ago
27 for (var i = 0; i < TV_SHOWS_WATCHED.length; ++i) {
28 const show_id = TV_SHOWS_WATCHED[i]
29 const url = `https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`
30 const resp = await fetch(url)
31 const show = await resp.json()
43 title: "My TV Shows",
44 link: "https://www.val.town/Glench.tvshows",
45 description: "Personal shows from tmdb api and val.town",
46 item: {
47 title: (x) =>

generateRAdioDjRssmain.tsx2 matches

@tmcw•Updated 7 months ago
5export const generateRAdioDjRss = async () => {
6 const rssItems = previousDjs.map((dj) => {
7 const djImgSrc = `https://r-a-d.io/api/dj-image/${
8 encodeURIComponent(
9 dj.djimage,
33 link: "https://r-a-d.io/",
34 description: "Informing you of when the DJ changes on r/a/dio with only a 15 minute delay!",
35 rssLink: "https://api.val.town/v1/express/pettan.generateRAdioDjRss",
36 })
37 return new Response(rssBody, { headers: { "Content-Type": "application/rss+xml" } })

hiraganaWordBuildermain.tsx2 matches

@ashryanio•Updated 7 months ago
91 setIsLoading(true);
92 try {
93 const response = await fetch(`/api/image/${romaji}`);
94 if (!response.ok) {
95 throw new Error("Failed to fetch image");
264 const url = new URL(request.url);
265
266 if (url.pathname.startsWith("/api/image/")) {
267 const romaji = url.pathname.split("/").pop();
268 try {

scholarlyIvoryWombatmain.tsx2 matches

@stevekrouse•Updated 7 months ago
40
41 try {
42 const response = await fetch("/api/chat", {
43 method: "POST",
44 headers: { "Content-Type": "application/json" },
134
135async function server(request: Request): Promise<Response> {
136 if (request.method === "POST" && new URL(request.url).pathname === "/api/chat") {
137 const { messages, model } = await request.json();
138 const client = new Cerebras();

sqlitemain.tsx4 matches

@boubou007•Updated 7 months ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type ResultSet, type Row, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {
78
79/* Val Town's Turso Proxy returns rows as an array of values
80 * Yet the LibSQL API has a Row type which behave as an array or object,
81 * ie you can access it via numerical index or string
82 */

getJsonAndRenderAsImageREADME.md4 matches

@ashryanio•Updated 7 months ago
16
17To easily upload an image to your blob storage, [fork this val](
18getBlobAndRenderAsImage), run it, and enter your API key in the password input.
19
20## How it works
29
30 - The server function calls `blob.getJSON("image-test")`.
31 - This `blob.getJSON()` method makes an HTTP request to the Val Town API.
32 - The API returns a Response object containing the JSON data.
33
34
72
73- [Blob storage overview in Val Town docs](https://docs.val.town/std/blob/)
74- [Val Town REST API references for blobs](https://docs.val.town/openapi#tag/blobs)
75- [Val Town blob std lib source code](https://www.val.town/v/std/blob)

hackerNewsDigestmain.tsx1 match

@workingpleasewait•Updated 7 months ago
1// This cron emails Hacker News stories from its API every 3 days.
2
3import { email } from "https://esm.town/v/std/email";

OpenAIREADME.md3 matches

@It_FITS_Marketing•Updated 7 months 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).
32If these limits are too low, let us know! You can also get around the limitation by using your own keys:
33
341. Create your own API key on [OpenAI's website](https://platform.openai.com/api-keys)
352. Create an [environment variable](https://www.val.town/settings/environment-variables?adding=true) named `OPENAI_API_KEY`
363. Use the `OpenAI` client from `npm:openai`:
37

OpenAImain.tsx7 matches

@It_FITS_Marketing•Updated 7 months 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 });

stockAPImain.tsx4 matches

@pete•Updated 7 months ago
1import { parse } from "https://deno.land/std@0.181.0/flags/mod.ts";
2
3const ALPHA_VANTAGE_API_KEY = "your_api_key_here"; // Replace with your actual API key
4
5async function fetchStockData(symbol: string) {
6 const apiUrl =
7 `https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=${symbol}&apikey=${ALPHA_VANTAGE_API_KEY}`;
8 const response = await fetch(apiUrl);
9 const data = await response.json();
10

vapi-minutes-db1 file match

@henrywilliams•Updated 3 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 3 days ago
mux
Your friendly, neighborhood video API.
api