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=1125&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 14220 results for "api"(2698ms)

vtApiTypesmain.tsx12 matches

@neverstew•Updated 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

add_to_habitify_from_todoist_w_aimain.tsx19 matches

@nerdymomocat•Updated 11 months ago
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

@iamseeley•Updated 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

@doublelotus•Updated 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

@doublelotus•Updated 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

@tmcw•Updated 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

resumeConfigmain.tsx3 matches

@ajax•Updated 11 months ago
63 {
64 "reference":
65 "Thomas is an extremely talented engineer with a very broad range of skills and experience. From being a thought leader in the front-end community via backbonetutorials.com and cdnjs.com, to designing and implementing the API for cdnjs.com, working with Thomas has been fantastic learning experience. Thomas is truly a full stack develop, and his work output is incredible. If there is any opportunity to work with Thomas, I take it. He is the definition of an A player.",
66 "name": "Ryan Kirkman, Senior Software Engineer at Nerdwallet",
67 },
257 ],
258 "summary":
259 "An international directory of civilian drone / UAV operators for hire. Services include aerial photography, aerial video, mapping, surveying, precision agriculture, real estate photography, remote inspections and infrared imaging. Our plan is to be the place to go when looking for UAV/Drone services. The website is built in Backbone.js and API is built with Node.js and Postgres. ",
260 "website": "http://www.dronehire.org",
261 "name": "Drone Hire",
279 {
280 "summary":
281 "Ephox is a worldwide company who is heavily involved with the development of TinyMce and enterprise editors. My primary role included building front-end widgets and applications. Worked on a major product using Backbone.js as a base. Heavily involved in UI/UX design and wire-framing. Also spend a lot of time designing API specifications and documentation.",
282 "website": "http://ephox.com",
283 "name": "Ephox",

modifyImageREADME.md1 match

@u•Updated 11 months ago
1Code from https://deno.com/blog/build-image-resizing-api
2
3Useful for compressing an image before sending to chatgpt4v, for example
19 "dog bites man",
20 "discord bot",
21 "github api",
22 "chat server integration",
23 ];

compareEmbeddingsmain.tsx1 match

@janpaul123•Updated 11 months ago
16 ["animal that barks", "discord bot"],
17 ["man bites dog", "discord bot"],
18 ["github api", "discord bot"],
19 ["chat server integration", "discord bot"],
20];

book-lookup5 file matches

@nucky•Updated 1 day ago
use google book api to look up bibliographic metadata elements

new-val-api-demo

@shouser•Updated 2 days ago
This is an example of using the API to create a val.
snartapi
mux
Your friendly, neighborhood video API.