Search

Results include substring matches and semantically similar vals. Learn more
adrienj avatar
cors_proxy
@adrienj
curl 'https://taras-free_open_router.web.val.run/api/v1/chat/completions' \ -H 'accept: application/json' \ -H 'authorization: Bearer THIS_IS_OVERRIDEN_ON_SERVER' \ -H 'content-type: application/json' \ --data-raw '{ "model": "auto", "temperature": 0, "messages": [ { "role": "system", "content": "stuff" }, { "role": "user", "content": "hello" } ], "stream": true }'
HTTP (deprecated)
curl 'https://taras-free_open_router.web.val.run/api/v1/chat/completions' \
-H 'accept: application/json' \
-H 'authorization: Bearer THIS_IS_OVERRIDEN_ON_SERVER' \
-H 'content-type: application/json' \
--data-raw '{
"model": "auto",
// Define a common set of CORS headers
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
rodrigotello avatar
CSScodeStyling
@rodrigotello
An interactive, runnable TypeScript val by rodrigotello
Script
export let CSScodeStyling =
"background:#e0f2fe; border-radius:4px; color:#082f49; font-family:monospace; padding-top:2px; padding-bottom:2px; padding-
bellafratantonio avatar
emailRandomJoke
@bellafratantonio
// Fetches a random joke.
Cron
// Fetches a random joke.
async function fetchRandomJoke() {
const response = await fetch(
"https://official-joke-api.appspot.com/random_joke",
return response.json();
const randomJoke = await fetchRandomJoke();
const setup = randomJoke.setup;
const punchline = randomJoke.punchline;
// Sends an email with the joke.
export const emailRandomJoke = email({
u avatar
minPerDay
@u
An interactive, runnable TypeScript val by u
Script
import { minPerHour } from "https://esm.town/v/u/minPerHour";
import { hourPerDay } from "https://esm.town/v/u/hourPerDay";
export let minPerDay = hourPerDay * minPerHour;
val avatar
postWebhookTest4
@val
An interactive, runnable TypeScript val by val
Script
import { fetchJSON } from "https://esm.town/v/val/fetchJSON";
export let postWebhookTest4 = fetchJSON(
"https://api.val.town/express/@val.postWebhook5",
method: "POST",
body: JSON.stringify({ name: "Steve" }),
stevekrouse avatar
example_gsmaverick_weather
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { weather } from "https://esm.town/v/gsmaverick/weather?v=17";
export let example_gsmaverick_weather = weather(new Date());
onixoni avatar
chat
@onixoni
OpenAI ChatGPT helper function This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free. import { chat } from "https://esm.town/v/stevekrouse/openai"; const { content } = await chat("Hello, GPT!"); console.log(content); import { chat } from "https://esm.town/v/stevekrouse/openai"; const { content } = await chat( [ { role: "system", content: "You are Alan Kay" }, { role: "user", content: "What is the real computer revolution?"} ], { max_tokens: 50, model: "gpt-4" } ); console.log(content);
Script
# OpenAI ChatGPT helper function
This val uses your OpenAI token if you have one, and the @std/openai if not, so it provides limited OpenAI usage for free.
```ts
const { content } = await chat("Hello, GPT!");
console.log(content);
```ts
async function getOpenAI() {
// if you don't have a key, use our std library version
if (Deno.env.get("OPENAI_API_KEY") === undefined) {
const { OpenAI } = await import("https://esm.town/v/std/openai");
stevekrouse avatar
aqiLocation
@stevekrouse
// deprecated in favor of @stevekrouse.openAQLocation
Script
// deprecated in favor of @stevekrouse.openAQLocation
export let aqiLocation = async ({ lat, lon }: { lat: number; lon: number }) => {
const { results } = fetchJSON(
"https://api.openaq.org/v2/locations?" +
new URLSearchParams({
limit: "10",
page: "1",
offset: "0",
sort: "asc",
radius: "10000",
ramkarthik avatar
raindropBookmarks
@ramkarthik
An interactive, runnable TypeScript val by ramkarthik
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export const raindropBookmarks = async (
page: Number,
raindropToken: String,
let options = {
"headers": { "Authorization": "Bearer " + raindropToken },
let data = await fetchJSON(
"https://api.raindrop.io/rest/v1/raindrops/0?perpage=20&page=" + page,
options,
return data;
pomdtr avatar
libsqlstudio
@pomdtr
LibSQLStudio UI for Val Town To authenticate, use the same email as your val town account.
HTTP (deprecated)
# LibSQLStudio UI for Val Town
![3fe0fa827f4c3b6e4efcce501182ffcaab898a6f8fb9e12ef44ee25e8e438ded.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/815d
To authenticate, use the same email as your val town account.
import { createApp } from "jsr:@pomdtr/libsqlstudio@0.0.2";
const app = createApp();
export default lastlogin(app.fetch, {
verifyEmail: verifyUserEmail
aryanj avatar
getBlockFees
@aryanj
An interactive, runnable TypeScript val by aryanj
HTTP (deprecated)
export default async function(req: Request): Promise<Response> {
const blockFeesResp = await fetch("https://mempool.space/api/v1/mining/blocks/fees/3y");
const blockFees = await blockFeesResp.json();
const dateAndDifficulties = blockFees.map(b => ({
dateTime: new Date(b.timestamp * 1000).toUTCString(),
avgFees: b.avgFees,
avgBlockHeight: b.avgHeight,
usd: b.USD,
const csvParser = new CsvParser();
const csv = csvParser.parse(dateAndDifficulties);
moe avatar
numbergame
@moe
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
// Game board size
const BOARD_SIZE = 5
// Hue difference between each power of two
const HUE_DIFF = 25
function getColor(value: number): string {
const power = Math.log2(value / 2)
const hue = (power * HUE_DIFF) % 360
return `hsl(${hue}, 50%, 50%)`
function App() {
jmpllu avatar
consoleEmailEx
@jmpllu
// email yourself as easily as logging to the console
Script
// email yourself as easily as logging to the console
export let consoleEmailEx = (() => {
console.email("message"); // any JSON object can be the message
console.email({ html: "<h1>hello html emails!</h1>" }); // you can send HTML emails
console.email({ hi: "there" }, "Subject Line"); // optional second arg is the subject line
console.email({ html: "<b>hi!</b>", subject: "Subject accepted here too" });
substrate avatar
twitterRAG
@substrate
NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to use it. Search on Twitter (powered by Exa ) and return a streaming markdown summary (powered by Substrate ). To fork, sign up for Substrate to get your own API key and $51 free credits. You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
HTTP (deprecated)
NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to use it.
Search on Twitter (powered by [Exa](https://exa.ai)) and return a streaming markdown summary (powered by [Substrate](https://
To fork, [sign up for Substrate](https://substrate.run/) to get your own API key and $51 free credits.
You'll also need Exa, which comes with generous free credits and can be a much cheaper alternative to the Twitter API.
// NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork and provide your own to run it.
const exa = new Exa(Deno.env.get("EXA_API_KEY"));
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const query = `"exa.ai" OR "@ExaAILabs"`;
// Search for tweets from the last week
const searchResults = await exa.searchAndContents(query, {
iamseeley avatar
convertResume
@iamseeley
convert your resume content to the json resume standard
HTTP (deprecated)
**convert your resume content to the [json resume](https://jsonresume.org/schema) standard**
export default async function convertResume(req: Request): Promise<Response> {
const html = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Resume to JSON</title>
<style>