Search

Results include substring matches and semantically similar vals. Learn more
substrate avatar
spanishLesson
@substrate
Generates spanish flashcards on a topic, including generated images and speech. 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
Generates spanish flashcards on a topic, including generated images and speech.
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
import inputHeader from "https://esm.town/v/substrate/inputHeader";
import { ComputeJSON, ComputeText, GenerateImage, GenerateSpeech, sb, Substrate } from "npm:substrate";
import { z } from "npm:zod";
const input = new URL(req.url).searchParams.get("input") || "scuba diving";
// Substrate graph
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const vocabLesson = z.object({
model: "Llama3Instruct70B",
const stream = await substrate.stream(html);
let { readable, writable } = new TransformStream();
kortina avatar
shotclip
@kortina
SHOTCLIP Demo of embedding images with substrate , and querying them for semantic relevance. Use the query parameter prompt to control the search.
HTTP (deprecated)
#### SHOTCLIP
Demo of embedding images with [substrate](https://www.substrate.run/), and querying them for semantic relevance.
Use the query parameter `prompt` to control the search.
![preview](https://media.substrate.run/shotclip-preview.png)
import { renderToString } from "npm:react-dom@18/server";
import { QueryVectorStore, sb, Substrate } from "npm:substrate";
type ShotResult = {
async function getResults(q: string, n: number): Promise<ShotResult[]> {
const substrate = new Substrate({
apiKey: process.env.SUBSTRATE_API_KEY,
const collectionName = "shotclip";
}, { cache_age: 60 * 60 });
const res = await substrate.run(query);
return res.get(query).results[0] as ShotResult[];
<a
href="https://www.substrate.run/"
style={{
fontSize: "12px",
[made with substrate]
</a>
kousun12 avatar
shotclip
@kousun12
SHOTCLIP Demo of embedding images with substrate , and querying them for semantic relevance. Use the query parameter prompt to control the search.
HTTP (deprecated)
#### SHOTCLIP
Demo of embedding images with [substrate](https://www.substrate.run/), and querying them for semantic relevance.
Use the query parameter `prompt` to control the search.
![preview](https://media.substrate.run/shotclip-preview.png)
import { renderToString } from "npm:react-dom@18/server";
import { QueryVectorStore, sb, Substrate } from "npm:substrate";
type ShotResult = {
async function getResults(q: string, n: number): Promise<ShotResult[]> {
const substrate = new Substrate({
apiKey: process.env.SUBSTRATE_API_KEY,
const collectionName = "shotclip";
}, { cache_age: 60 * 60 });
const res = await substrate.run(query);
return res.get(query).results[0] as ShotResult[];
<a
href="https://www.substrate.run/"
style={{
fontSize: "12px",
[made with substrate]
</a>
substrate avatar
websim
@substrate
WebSim on Val with Substrate 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
[WebSim](https://x.com/websim_ai) on Val with Substrate
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
import urlHeader from "https://esm.town/v/substrate/urlHeader";
import { ComputeText, GenerateImage, sb, Substrate, UpscaleImage } from "npm:substrate";
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
export default async function render(req: Request): Promise<Response> {
image.cache_age = 60 * 60 * 24;
const res = await substrate.run(image);
const imageUri = res.get(image).image_uri;
model: "Llama3Instruct70B",
const stream = await substrate.stream(html);
let { readable, writable } = new TransformStream();
substrate avatar
urlHeader
@substrate
used in https://www.val.town/v/substrate/websim import urlHeader from "https://esm.town/v/substrate/urlHeader"; export default async function(req: Request): Promise<Response> { const searchParams = new URL(req.url).searchParams; const { url = "foo" } = Object.fromEntries(searchParams); const html = ` ${urlHeader(url)} <div>content</div> `; return new Response(html, { headers: { "Content-Type": "text/html", }, }); }
HTTP (deprecated)
used in https://www.val.town/v/substrate/websim
```tsx
import urlHeader from "https://esm.town/v/substrate/urlHeader";
export default async function(req: Request): Promise<Response> {
<div style="text-align:right;background-color:#000;padding:4px;border-radius:4px;">
<a href="https://www.substrate.run" target="_blank" style="font-size:0.8rem;color:#fff;text-decoration:none;display:block
<a href="#" onclick="window.open(getSourceUrl(), '_blank')" style="font-size:0.8rem;color:#fff;text-decoration:none;displ
substrate avatar
similarSites
@substrate
NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to fork & provide your own to use it. Find similar pages on HN and return a streaming markdown summary. Powered by Exa and Substrate . 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits.
HTTP (deprecated)
Find similar pages on HN and return a streaming markdown summary.
Powered by [Exa](https://exa.ai/) and [Substrate](https://substrate.run).
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits.
import urlHeader from "https://esm.town/v/substrate/urlHeader";
import Exa from "npm:exa-js";
import { ComputeText, GenerateImage, sb, Substrate } from "npm:substrate";
// NOTE: We've disabled the Exa API key in this demo due to high volume – you'll need to provide your own to use it.
const exa = new Exa(Deno.env.get("EXA_API_KEY"));
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
export default async function handler(req: Request): Promise<Response> {
model: "Llama3Instruct70B",
const stream = await substrate.stream(summary);
let { readable, writable } = new TransformStream();
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.
Exa](https://exa.ai)) and return a streaming markdown summary (powered by [Substrate](https://substrate.run)).
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.
import Exa from "npm:exa-js";
import { ComputeJSON, ComputeText, sb, Substrate } from "npm:substrate";
import { z } from "npm:zod";
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"`;
}); markdown.id = "markdown";
const stream = await substrate.stream(markdown);
// Render streaming markdown
export default async function handler(req: Request): Promise<Response> {
const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default;
return renderMarkdown(stream);
substrate avatar
promptHeader
@substrate
Prompt header import promptHeader from "https://esm.town/v/substrate/promptHeader"; export default async function(req: Request): Promise<Response> { const searchParams = new URL(req.url).searchParams; const { prompt = "foo" } = Object.fromEntries(searchParams); const html = ` ${promptHeader(prompt)} <div>content</div> `; return new Response(html, { headers: { "Content-Type": "text/html", }, }); }
HTTP (deprecated)
```tsx
import promptHeader from "https://esm.town/v/substrate/promptHeader";
export default async function(req: Request): Promise<Response> {
</div>
<div style="position:absolute;top:8px;right:8px;text-align:right;">
<a href="https://www.substrate.run" target="_blank" style="font-size:0.8rem;color:#000;text-decoration:none;display:block
<a href="#" onclick="window.open(getSourceUrl(), '_blank')" style="font-size:0.8rem;color:#000;text-decoration:none;displ
</div>
cw12 avatar
intro
@cw12
Generate a story and summarize it using Substrate . 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits.
HTTP (deprecated)
Generate a story and summarize it using [Substrate](https://substrate.run/).
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits.
import { ComputeText, sb, Substrate } from "npm:substrate";
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const story = new ComputeText({ prompt: "tell me a story, be concise", max_tokens: 800 });
prompt: sb.interpolate`summarize this story in one sentence. do not preface the summary: ${story.future.text}`,
const stream = await substrate.stream(summary);
export default async function render(req: Request): Promise<Response> {
return new Response("User-agent: *\nDisallow: /");
const renderNodeResults = (await import("https://esm.town/v/substrate/renderNodeResults")).default;
return renderNodeResults(stream);
substrate avatar
subaudio
@substrate
sub.audio – generate subtitles and chapters for any audio URL. Speech-to-text and chapter summaries powered by Substrate 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
[sub.audio](https://sub.audio) – generate subtitles and chapters for any audio URL.
Speech-to-text and chapter summaries powered by [Substrate](https://substrate.run)
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
import { ComputeJSON, sb, Substrate, TranscribeSpeech } from "npm:substrate";
export const listChapters = `Please provide a list of sections for the following transcript.
async function processAudio(audio_uri) {
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const opts = { cache_age: 60 * 60 * 24 * 7 };
opts,
const res = await substrate.run(transcribe, chapters, timestamps);
return {
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="https://www.substrate.run/favicon.ico" type="image/x-icon">
<link
!audio_uri
? `<a id="federer-link" href="?url=https://media.substrate.run/federer-dartmouth.m4a">Or try an example: federer-dartmo
<div id="loading">Running...</div>
</div>
<a id="made-with" href="https://substrate.run" target="_blank"
>made with <b>substrate</b></a
<a id="view-source" href="${extractValInfo(import.meta.url).htmlUrl}" target="_blank"
vprtwn avatar
IllustratedPrimer
@vprtwn
Generates a streaming illustrated primer on a subject. Open the url and add a query parameter with a subject: https://vprtwn-illustratedprimer.web.val.run/?subject=libra
HTTP (deprecated)
import { ComputeJSON, ComputeText, GenerateImage, sb, Substrate } from "npm:substrate";
import { z } from "npm:zod";
const { subject = "ball lightning" } = Object.fromEntries(new URL(req.url).searchParams);
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const Topic = z
const nodes = [image1, caption1, image2, caption2, image3, caption3, image4, caption4];
const stream = await substrate.stream(...nodes);
return new Response(
substrate avatar
gifStory
@substrate
Generates a story and then a storyboard with 5 animated frames. Note : You'll need to fork this example (and un-comment some code) to run it with new input. Currently it renders cached output, for demo purposes (running takes 30-60s). 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
import { ComputeJSON, ComputeText, GenerateImage, sb, StableVideoDiffusion, Substrate } from "npm:substrate";
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
// const res = await substrate.run(...videoNodes);
"https://cdn.substrate.run/u/TdI00FeAB8nzr0Su/d73078011783f5ac37980e47df9d0ee7985fd2d476eed501_1722427247.gif",
"https://cdn.substrate.run/u/TdI00FeAB8nzr0Su/69c79387d16391d3f8c246ccbd694bed55f39d3a60a66fde_1722427247.gif",
"https://cdn.substrate.run/u/TdI00FeAB8nzr0Su/75db479fdc66d185edbf24f7b037257adb98ec7bfe7b10db_1722427248.gif",
"https://cdn.substrate.run/u/TdI00FeAB8nzr0Su/bd26d54a083b540210ac23bc9fd296fc13db9a9edff6718b_1722427271.gif",
"https://cdn.substrate.run/u/TdI00FeAB8nzr0Su/b14849ad8bb9af9c60567d85d37de79c1d634748ed6ad9d4_1722427265.gif",
<title>GIF Story | Substrate</title>
<a href="https://www.substrate.run" target="_blank" style="font-size:0.8rem;color:#000;text-decoration:none;display:blo
cofsana avatar
websim
@cofsana
WebSim on Val with Substrate 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
[WebSim](https://x.com/websim_ai) on Val with Substrate
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
import urlHeader from "https://esm.town/v/substrate/urlHeader";
import { ComputeText, GenerateImage, sb, Substrate, UpscaleImage } from "npm:substrate";
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
export default async function render(req: Request): Promise<Response> {
image.cache_age = 60 * 60 * 24;
const res = await substrate.run(image);
const imageUri = res.get(image).image_uri;
model: "Llama3Instruct70B",
const stream = await substrate.stream(html);
let { readable, writable } = new TransformStream();
yawnxyz avatar
shapeshift
@yawnxyz
Semantically map a JSON object to a target schema using an LLM. (Click "Run") Inspired by https://github.com/rectanglehq/Shapeshift HN thread Check out Substrate !
Script
Inspired by https://github.com/rectanglehq/Shapeshift [HN thread](https://news.ycombinator.com/item?id=40972130)
Check out [Substrate](https://substrate.run/)!
import { ComputeJSON, ComputeText, sb, Substrate } from "npm:substrate";
import { z } from "npm:zod";
import { zodToJsonSchema } from "npm:zod-to-json-schema";
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY")});
const sourceObj = {
json_schema: zodToJsonSchema(TargetObjSchema),
const res = await substrate.run(json);
console.log(JSON.stringify(res.get(json).json_object, null, 2));
stevekrouse avatar
subaudio
@stevekrouse
sub.audio – generate subtitles and chapters for any audio URL. Speech-to-text and chapter summaries powered by Substrate 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
HTTP (deprecated)
[sub.audio](https://sub.audio) – generate subtitles and chapters for any audio URL.
Speech-to-text and chapter summaries powered by [Substrate](https://substrate.run)
🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits
import { ComputeJSON, sb, Substrate, TranscribeSpeech } from "npm:substrate";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
async function processAudio(audio_uri) {
const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });
const opts = { cache_age: 60 * 60 * 24 * 7 };
opts,
const res = await substrate.run(transcribe, chapters, timestamps);
return {
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="https://www.substrate.run/favicon.ico" type="image/x-icon">
<link
!audio_uri
? `<a id="federer-link" href="?url=https://media.substrate.run/federer-dartmouth.m4a">Or try an example: federer-dartmo
<div id="loading">Running...</div>
</div>
<a id="made-with" href="https://substrate.run" target="_blank"
>made with <b>substrate</b></a
<a id="view-source" href="${extractValInfo(import.meta.url).htmlUrl}" target="_blank"