Substrate is the modular API for fast multi-step AI programs
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)
Run AI with an API
You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$1?q=api&page=2&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 15177 results for "api"(1705ms)
1# Autonomous Val
2This project demonstrates how to build autonomous agents on Val Town that can be triggered by API calls, cron jobs, etc.
34
89Configure the following variables in your environment:
10- `AGENT_API_KEY` (This is a secure token that you choose to secure the agent.tsx POST endpoint)
11- `OPENAI_API_KEY` (An OpenAI API Key)
12- `EXA_API_KEY` (Optional, though needed if you use the web search tool)
1314## Usage
15Use `demo.tsx` to send objectives to your agent.
1617### API Usage
18To use the API from another client, you can POST authenticated requests to the agent.tsx endpoint:
1920```javascript
30headers: {
31"Content-Type": "application/json",
32"Authorization": `Bearer ${Deno.env.get("AGENT_API_KEY")}`,
33},
34body: JSON.stringify(requestBody),
3738### Streaming Chat
39The API will also work with streaming chat front ends based on the Vercel AI SDK's useChat hook.
4041You just need to pass `streamResults: true` in your API POST request.
4243## Using Other Models
12app.get("/frontend/**/*", c => serveFile(c.req.path, import.meta.url));
1314// Add your API routes here
15// app.get("/api/data", c => c.json({ hello: "world" }));
1617// Unwrap and rethrow Hono errors as the original error