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=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 17515 results for "api"(7011ms)

dubLinksUpsertREADME.md2 matches

@evilsteventeyUpdated 1 year ago
1This val shows how you can use the new `dub.links.upsert` method to shorten a URL using the [Dub API](https://dub.co/docs/api-reference/introduction) without creating duplicate links in your workspace for the given URL.
2
3- SDK Docs: [dub.links.upsert](https://dub.co/docs/sdks/typescript/links/upsert)
4- API Docs: [api.dub.co/links/upsert](https://dub.co/docs/api-reference/endpoint/upsert-a-link)

dubLinksUpsertmain.tsx1 match

@evilsteventeyUpdated 1 year ago
3
4const dub = new Dub({
5 token: Deno.env.get("DUB_API_KEY"), // optional – defaults to process.env.DUB_API_KEY
6 workspaceId: "ws_clw65kb1i000014o06p0qaczn", // Dub workspace ID – https://d.to/id
7});

dubLinksUpsertREADME.md2 matches

@steventeyUpdated 1 year ago
1This val shows how you can use the new `dub.links.upsert` method to shorten a URL using the [Dub API](https://dub.co/docs/api-reference/introduction) without creating duplicate links in your workspace for the given URL.
2
3- SDK Docs: [dub.links.upsert](https://dub.co/docs/sdks/typescript/links/upsert)
4- API Docs: [api.dub.co/links/upsert](https://dub.co/docs/api-reference/endpoint/upsert-a-link)
5
6Migrated from folder: dub/dubLinksUpsert

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

RandomQuoteAPI

@FreelzyUpdated 17 hours ago

HAPI7 file matches

@dIgitalfulusUpdated 23 hours ago
Kapil01
apiv1