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/$%7Burl%7D?q=api&page=1470&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"(7146ms)

tootLatestPostsmain.tsx1 match

@geraldoUpdated 1 year ago
11 .map((item) =>
12 postToMastodon(
13 "https://floss.social/api/v1",
14 Deno.env.get("mastodonAccessToken"),
15 `${item.title.charAt(0) === "↗" ? "🔗" : "✍️"} ${item.title.replace("↗ ", "")} ${item.link}`,

limit_model_forkmain.tsx5 matches

@stdUpdated 1 year ago
1import { parseBearerString } from "https://esm.town/v/andreterron/parseBearerString";
2import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
3import { RateLimit } from "npm:@rlimit/http";
4
24 const authHeader = req.headers.get("Proxy-Authorization") || req.headers.get("Authorization");
25 const token = authHeader ? parseBearerString(authHeader) : undefined;
26 const meRes = await fetch(`${API_URL}/v1/me`, { headers: { Authorization: `Bearer ${token}` } });
27 if (!meRes.ok) {
28 return new Response("Unauthorized", { status: 401 });
38
39 // Proxy the request
40 const url = new URL("." + pathname, "https://api.openai.com");
41 url.search = search;
42
43 const headers = new Headers(req.headers);
44 headers.set("Host", url.hostname);
45 headers.set("Authorization", `Bearer ${Deno.env.get("OPENAI_API_KEY")}`);
46 headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
47
48 const openAIRes = await fetch(url, {

limit_model_forkREADME.md1 match

@stdUpdated 1 year ago
1# OpenAI Proxy
2
3This OpenAI API proxy injects Val Town's API keys. For usage documentation, check out https://www.val.town/v/std/openai

pushovermain.tsx3 matches

@harperUpdated 1 year ago
2
3// Send a pushover message.
4// token, user, and other opts are as specified at https://pushover.net/api
5export async function pushover({ token, user, message, title, device, ...opts }) {
6 try {
14 });
15
16 const response = await fetch("https://api.pushover.net/1/messages.json", {
17 method: "POST",
18 headers: {
24 if (!response.ok) {
25 const errorData = await response.json();
26 console.error("Pushover API Error:", errorData);
27 throw new Error(`HTTP error! status: ${response.status}`);
28 }

ShopifyProductSearchmain.tsx2 matches

@harperUpdated 1 year ago
3export async function ShopifyProductSearch(brokerId, first = 20) {
4 // The GraphQL endpoint you're going to query
5 const url = "https://shop.app/web/api/graphql";
6
7 // The GraphQL query
217 };
218
219 // Headers can include things like `Content-Type` and any authorization tokens required by the API
220 const headers = {
221 "Content-Type": "application/json",

OpenAImain.tsx7 matches

@pattysiUpdated 1 year 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 });

OpenAIREADME.md3 matches

@pattysiUpdated 1 year 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
5Streaming is not yet supported. Upvote the [HTTP response streaming feature request](https://github.com/val-town/val-town-product/discussions/14) if you need it!
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

bookmarkletsmain.tsx3 matches

@pomdtrUpdated 1 year ago
1/** @jsxImportSource https://esm.sh/hono@3.9.2/jsx **/
2import { api } from "https://esm.town/v/pomdtr/api";
3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
4import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
36
37app.get("/", async c => {
38 const { data: vals } = await api(`/v1/search/vals?query=${encodeURIComponent("#bookmarklet")}`);
39
40 const bookmarklets = await Promise.all(
85app.get("/v/:author/:name", async c => {
86 const { author, name } = c.req.param();
87 const { privacy } = await api(`/v1/alias/${author}/${name}`);
88 if (privacy === "private") {
89 return c.notFound();

gistsmain.tsx1 match

@yieldrayUpdated 1 year ago
3const USERNAME = "yieldray"; // <--- Replace with your Github username
4
5const gistList: Array<Gist> = await fetch(`https://api.github.com/users/${USERNAME}/gists`).then((res) => res.json());
6
7app.get("/", (req) => {

translatormain.tsx4 matches

@yawnxyzUpdated 1 year ago
5
6const app = new Hono();
7const openai = new OpenAI(Deno.env.get("OPENAI_API_KEY_VOICE"));
8
9class TranscriptionService {
18 return transcription;
19 } catch (error) {
20 console.error('OpenAI API error:', error);
21 throw error;
22 }
368 return c.text(translation);
369 } catch (error) {
370 console.error('OpenAI API error:', error);
371 return c.text('Error occurred during translation', 500);
372 }
395 });
396 } catch (error) {
397 console.error('OpenAI API error:', error);
398 return c.text('Error occurred during speech generation', 500);
399 }

RandomQuoteAPI

@FreelzyUpdated 17 hours ago

HAPI7 file matches

@dIgitalfulusUpdated 22 hours ago
Kapil01
apiv1