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=992&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 12889 results for "api"(2026ms)

valTownChatGPTmain.tsx1 match

@simonwUpdated 11 months ago
3import { renderToString } from "npm:react-dom/server";
4
5// This uses by personal API key, you'll need to provide your own if
6// you fork this. We'll be adding support to the std/openai lib soon!
7const openai = new OpenAI();

fetchTodaysNytCxPuzzlemain.tsx2 matches

@plrUpdated 11 months ago
37 mini?: boolean;
38}): Promise<PuzzlesData> => {
39 // https://api.foracross.com/api/puzzle_list?page=0&pageSize=50&filter%5BnameOrTitleFilter%5D=ny%20times%20june%2019%202024&filter%5BsizeFilter%5D%5BMini%5D=true&filter%5BsizeFilter%5D%5BStandard%5D=true
40 const url = new URL("https://api.foracross.com/api/puzzle_list");
41 const search = new URLSearchParams();
42 search.set("page", `${page}`);

pipelinemain.tsx17 matches

@iamseeleyUpdated 11 months ago
1const HUGGING_FACE_API_URL = "https://api-inference.huggingface.co/models";
2const HUGGING_FACE_API_KEY = Deno.env.get("HUGGING_FACE_API_KEY");
3
4const defaultModels = {
60
61 async featureExtraction(input, options) {
62 return this.callHuggingFaceAPI(input, options);
63 }
64
65 async textClassification(input, options) {
66 return this.callHuggingFaceAPI(input, options);
67 }
68
69 async tokenClassification(input, options) {
70 return this.callHuggingFaceAPI(input, options);
71 }
72
73 async questionAnswering(input, options) {
74 return this.callHuggingFaceAPI(input, options);
75 }
76
77 async summarization(input, options) {
78 return this.callHuggingFaceAPI(input, options);
79 }
80
81 async translation(input, options) {
82 return this.callHuggingFaceAPI(input, options);
83 }
84
85 async textGeneration(input, options) {
86 return this.callHuggingFaceAPI(input, options);
87 }
88
89 async sentenceSimilarity(input, options) {
90 return this.callHuggingFaceAPI(input, options);
91 }
92
93 async callHuggingFaceAPI(payload, options) {
94 try {
95 const response = await fetch(`${HUGGING_FACE_API_URL}/${this.model}`, {
96 method: "POST",
97 headers: {
98 "Authorization": `Bearer ${HUGGING_FACE_API_KEY}`,
99 "Content-Type": "application/json"
100 },
104 if (!response.ok) {
105 const error = await response.json();
106 console.error("Hugging Face API Error:", error);
107 return { error: `API request failed: ${error.error}` };
108 }
109
111 return data;
112 } catch (error) {
113 console.error("Error calling Hugging Face API:", error);
114 return { error: "Error calling Hugging Face API" };
115 }
116 }

verifyTokenmain.tsx1 match

@pomdtrUpdated 11 months ago
1async function fetchUser(token: string): Promise<{ id: string }> {
2 const resp = await fetch("https://api.val.town/v1/me", {
3 headers: {
4 Authorization: `Bearer ${token}`,

vtApiTypesmain.tsx12 matches

@neverstewUpdated 11 months ago
1/**
2 * This file was auto-generated by openapi-typescript.
3 * Do not make direct changes to the file.
4 */
427 * Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.
428 *
429 * Vals generated via this API will *not* appear in the authenticated user's workspace.
430 */
431 get: {
463 * Authenticated use will have read access to the authenticated user's private vals and secrets, write access to the authenticated user's vals, and the ability to send the authenticated user emails via `console.email`.
464 *
465 * Vals generated via this API will *not* appear in the authenticated user's workspace.
466 */
467 post: {
494 "/v1/run/{username}.{val_name}": {
495 /**
496 * Run a val as an API
497 * @deprecated
498 * @description This endpoint runs the specified user's val and returns the output.
526 };
527 /**
528 * Run a val as an API
529 * @deprecated
530 */
563 "/": {
564 /**
565 * Run a val as an API (as an Express handler)
566 * @description Runs `@{username}.{val_name}` as an Express handler.
567 *
568 * `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
569 *
570 * Unlike the other two APIs, the Express API is specified via subdomain and runs at `https://{username}-{val_name}.express.val.run`.
571 *
572 * ### Unauthenticated
573 * Unauthenticated use will only be able to call public vals as Express handlers.
574 *
575 * The val will be executed with `{username}`'s permissions ("API Mode"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.
576 *
577 * ### Authenticated
601 };
602 /**
603 * Run a val as an API (as an Express handler)
604 * @description Runs `@{username}.{val_name}` as an Express handler.
605 *
606 * `@{username}.{val_name}` must be a function. It is passed the Express [`req`](https://expressjs.com/en/4x/api.html#req) and [`res`](https://expressjs.com/en/4x/api.html#res) objects as its arguments. You can use `req` to pull out request data, and `res` to respond with any valid Express response. Learn more at the [Express docs](https://expressjs.com/en/4x/api.html).
607 *
608 * ### Unauthenticated
609 * Unauthenticated use will only be able to call public vals as Express handlers.
610 *
611 * The val will be executed with `{username}`'s permissions ("API Mode"), so it will be able to read and write to `{username}`'s public and private vals, secrets, and use `console.email`.
612 *
613 * ### Authenticated
1import { blob } from "https://esm.town/v/std/blob";
2import process from "node:process";
3import { TodoistApi } from "npm:@doist/todoist-api-typescript";
4import Instructor from "npm:@instructor-ai/instructor";
5import Jimp from "npm:jimp";
15// the task is skipped
16
17const TODOIST_API_KEY = process.env.TODOIST_API_KEY;
18const HABITIFY_API_KEY = process.env.HABITIFY_API_KEY;
19const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
20const DEF_TIMEZONE = "America/Los_Angeles"; // Get your timezone from here: https://stackoverflow.com/a/54500197
21
47};
48
49const todoistapi = new TodoistApi(TODOIST_API_KEY);
50
51const oai = new OpenAI({
52 apiKey: OPENAI_API_KEY ?? undefined,
53});
54
107async function getCommentsForTask(taskId) {
108 try {
109 const comments = await todoistapi.getComments({ taskId });
110 return comments;
111 } catch (error) {
137 const response = await fetch(url, {
138 headers: {
139 Authorization: `Bearer ${TODOIST_API_KEY}`,
140 },
141 });
310
311async function addLog(habit_id, unit_type, value, target_date) {
312 const url = `https://api.habitify.me/logs/${habit_id}`;
313 const headers = {
314 Authorization: HABITIFY_API_KEY,
315 "Content-Type": "application/json",
316 };
338}
339async function addTextNote(habit_id, created, content) {
340 const url = `https://api.habitify.me/notes/${habit_id}`;
341 const headers = {
342 Authorization: HABITIFY_API_KEY,
343 "Content-Type": "application/json",
344 };
366
367async function addImageNote(habit_id, created_at, imageBuffer) {
368 const url = `https://api.habitify.me/notes/addImageNote/${habit_id}?created_at=${encodeURIComponent(created_at)}`;
369 const headers = {
370 Authorization: HABITIFY_API_KEY,
371 "Content-Type": "image/jpeg",
372 };
395 if (!habits_list || force_update_database)
396 {
397 const HABITIFY_API_KEY = process.env.HABITIFY_API_KEY;
398 const url = "https://api.habitify.me/habits";
399 const headers = {
400 Authorization: HABITIFY_API_KEY,
401 "Content-Type": "application/json",
402 };
456export default async function(interval: Interval) {
457 const habits_list = await get_habitify_database();
458 var tasks = await todoistapi.getTasks({
459 projectId: add_to_habitify_todoist_project_id,
460 });
520 }
521 }
522 await todoistapi.deleteTask(task.id);
523 }
524}

hfApiGatewayREADME.md12 matches

@iamseeleyUpdated 11 months ago
1## 🤖 A gateway to Hugging Face's Inference API
2
3You can perform various NLP tasks using different [models](https://huggingface.co/models). The gateway supports multiple tasks, including feature extraction, text classification, token classification, question answering, summarization, translation, text generation, and sentence similarity.
21```bash
22# Example Default Model Request
23 curl -X POST -H "Content-Type: application/json" -d '{"inputs": {"source_sentence": "Hello World", "sentences": ["Goodbye World", "How are you?", "Nice to meet you."]}}' "https://iamseeley-hfapigateway.web.val.run/?task=feature-extraction"
24```
25
28**Feature Extraction**
29```bash
30curl -X POST -H "Content-Type: application/json" -d '{"inputs": ["Hello World", "Goodbye World"]}' "https://iamseeley-hfapigateway.web.val.run/?task=feature-extraction&model=BAAI/bge-base-en-v1.5"
31```
32**Feature Extraction**
33```bash
34curl -X POST -H "Content-Type: application/json" -d '{"inputs": {"source_sentence": "Hello World", "sentences": ["Goodbye World", "How are you?", "Nice to meet you."]}}' "https://iamseeley-hfapigateway.web.val.run/?task=feature-extraction&model=sentence-transformers/all-MiniLM-L6-v2"
35```
36**Text Classification**
37```bash
38curl -X POST -H "Content-Type: application/json" -d '{"inputs": "I love programming!"}' "https://iamseeley-hfapigateway.web.val.run/?task=text-classification&model=j-hartmann/emotion-english-distilroberta-base"
39```
40**Token Classification**
41```bash
42curl -X POST -H "Content-Type: application/json" -d '{"inputs": "My name is John and I live in New York."}' "https://iamseeley-hfApiGateway.web.val.run/?task=token-classification&model=dbmdz/bert-large-cased-finetuned-conll03-english"
43```
44**Question Answering**
45```bash
46curl -X POST -H "Content-Type: application/json" -d '{"inputs": {"question": "What is the capital of France?", "context": "The capital of France is Paris, a major European city and a global center for art, fashion, gastronomy, and culture."}}' "https://iamseeley-hfapigateway.web.val.run/?task=question-answering&model=deepset/roberta-base-squad2"
47```
48**Summarization**
49```bash
50curl -X POST -H "Content-Type: application/json" -d '{"inputs": "The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."}' "https://iamseeley-hfapigateway.web.val.run/?task=summarization&model=sshleifer/distilbart-cnn-12-6"
51```
52**Translation**
53```bash
54curl -X POST -H "Content-Type: application/json" -d '{"inputs": "Hello, how are you?"}' "https://iamseeley-hfapigateway.web.val.run/?task=translation&model=google-t5/t5-small"
55```
56**Text Generation**
57```bash
58curl -X POST -H "Content-Type: application/json" -d '{"inputs": "Once upon a time"}' "https://iamseeley-hfapigateway.web.val.run/?task=text-generation&model=gpt2"
59```
60**Sentence Similarity**
61```bash
62curl -X POST -H "Content-Type: application/json" -d '{"inputs": {"source_sentence": "Hello World", "sentences": ["Goodbye World"]}}' "https://iamseeley-hfapigateway.web.val.run/?task=sentence-similarity&model=sentence-transformers/all-MiniLM-L6-v2"
63```
64
93[exampleQuestionAnswering](https://esm.town/v/iamseeley/exampleQuestionAnswering)
94
95Migrated from folder: hf_gateway/hfApiGateway

dailyDadJokemain.tsx1 match

@doublelotusUpdated 11 months ago
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 console.log(setup, punchline);
7 return email({

dailyDadJokeREADME.md2 matches

@doublelotusUpdated 11 months ago
113. 🤣🤣🤣🤣
12
13## API
14
15This val uses the [icanhazdadjoke API](https://icanhazdadjoke.com/api). You can find [more docs here](https://github.com/15Dkatz/official_joke_api), such as how to [filter by type](https://github.com/15Dkatz/official_joke_api?tab=readme-ov-file#grab-jokes-by-type).

fuchsiaSnipemain.tsx1 match

@tmcwUpdated 11 months ago
1export default async function(req: Request): Promise<Response> {
2 const response = await fetch("http://worldtimeapi.org/api/timezone/America/New_York")
3 const timeData = await response.json()
4

vapi-minutes-db1 file match

@henrywilliamsUpdated 1 day ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 1 day ago
papimark21
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration