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/$1?q=api&page=42&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 18274 results for "api"(4949ms)

linearStandupmain.tsx9 matches

@kitimborinoโ€ขUpdated 2 days ago
57
58export async function exec(interval: Interval) {
59 const apiKey = Deno.env.get("LINEAR_API_KEY");
60 if (!apiKey) {
61 console.error("LINEAR_API_KEY not found in environment variables");
62 Deno.exit(1);
63 }
65 const { startDate, endDate } = getYesterdayDateRange();
66
67 const response = await fetch("https://api.linear.app/graphql", {
68 method: "POST",
69 headers: {
70 "Content-Type": "application/json",
71 Authorization: apiKey,
72 },
73 body: JSON.stringify({
80
81 if (data.errors) {
82 console.error("Error fetching data from Linear API:", data.errors);
83 Deno.exit(1);
84 }
94 }
95
96 const historyResponse = await fetch("https://api.linear.app/graphql", {
97 method: "POST",
98 headers: {
99 "Content-Type": "application/json",
100 Authorization: apiKey,
101 },
102 body: JSON.stringify({
190 }
191
192 const slackResponse = await fetch("https://slack.com/api/chat.postMessage", {
193 method: "POST",
194 headers: {

autonomous-valtools.tsx4 matches

@charmaineโ€ขUpdated 2 days ago
77 }),
78 execute: async ({ query }) => {
79 const apiKey = Deno.env.get("EXA_API_KEY");
80 const exa = new Exa(apiKey);
81 const result = await exa.searchAndContents(query, {
82 text: true,
100 }),
101 execute: async ({ url }) => {
102 const apiKey = Deno.env.get("EXA_API_KEY");
103 const exa = new Exa(apiKey);
104 const result = await exa.getContents([url], { text: true });
105 return {

autonomous-valREADME.md9 matches

@charmaineโ€ขUpdated 2 days ago
1# Autonomous Val
2This project demonstrates how to build autonomous agents on Val Town that can be triggered by API calls, cron jobs, etc.
3
4![Screenshot 2025-05-29 at 8.03.54โ€ฏPM.png](https://imagedelivery.net/iHX6Ovru0O7AjmyT5yZRoA/8d53ae11-7cc7-415d-9a2d-edd9c66c5500/public)
8
9Configure 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)
13
14## Usage
15Use `demo.tsx` to send objectives to your agent.
16
17### API Usage
18To use the API from another client, you can POST authenticated requests to the agent.tsx endpoint:
19
20```javascript
30 headers: {
31 "Content-Type": "application/json",
32 "Authorization": `Bearer ${Deno.env.get("AGENT_API_KEY")}`,
33 },
34 body: JSON.stringify(requestBody),
37
38### Streaming Chat
39The API will also work with streaming chat front ends based on the Vercel AI SDK's useChat hook.
40
41You just need to pass `streamResults: true` in your API POST request.
42
43## Using Other Models

autonomous-valdiagram.tsx1 match

@charmaineโ€ขUpdated 2 days ago
5 linkStyle default stroke:#aaaaaa,stroke-width:1.5px
6
7 API[API] <--> Agent
8
9 subgraph "Agent Runtime"

autonomous-valdemo.tsx5 matches

@charmaineโ€ขUpdated 2 days ago
22 objective = formData.get("objective")?.toString() || objective;
23
24 // Continue with API call using the submitted objective
25 } else {
26 return new Response("Unsupported content type", { status: 415 });
27 }
28
29 // Make API call with the objective from the form
30 const requestBody = {
31 messages: [
40 headers: {
41 "Content-Type": "application/json",
42 "Authorization": `Bearer ${Deno.env.get("AGENT_API_KEY")}`,
43 },
44 body: JSON.stringify(requestBody),
50 }
51
52 // Get the API response data
53 const responseData = await response.json();
54 console.log("API Response:", responseData);
55
56 // Return HTML with the results

autonomous-valagent.tsx2 matches

@charmaineโ€ขUpdated 2 days ago
17
18export default async function POST(req: Request) {
19 if (req.headers.get("Authorization") !== `Bearer ${Deno.env.get("AGENT_API_KEY")}`) {
20 return new Response("Unauthorized", { status: 401 });
21 }
34 const maxSteps = 10;
35
36 const model = Deno.env.get("ANTHROPIC_API_KEY") ? anthropic("claude-3-7-sonnet-latest") : openai("gpt-4.1");
37
38 const options = {

asurareleasesbotfile.txt11 matches

@asurgiftโ€ขUpdated 2 days ago
264}
265
266/*โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ 8 โ–ธ Scraping Logic โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€*/
267function buildChapterObject(
268 $: cheerio.CheerioAPI,
269 chapterLinkElement: cheerio.Element,
270 seriesTitle: string,
305
306async function scrapeMainPageForChapterEvents(): Promise<ChapterEventInfo[]> {
307 log("Scraping main page for chapter events:", BASE_URL);
308 const chapterEvents: ChapterEventInfo[] = [];
309 try {
419 seriesPageUrl: string,
420): Promise<Pick<ChapterEventInfo, "definitiveSeriesTitle" | "definitiveSeriesImage" | "synopsis">> {
421 log("Scraping series page for details:", seriesPageUrl);
422 try {
423 const { data } = await httpClient.get(seriesPageUrl, { responseType: "text" });
531 log(`=== Multi-Event Announcer (Ch1, Season Start/End) to ${PRIMARY_CHAT_ID} then ${SECONDARY_CHAT_ID} ===`);
532 try {
533 await bot.api.getMe();
534 log("Bot token validated.");
535 }
640 log(`Announcing to PRIMARY (${PRIMARY_CHAT_ID}): ${nameOfManhwa} - Event: ${event.eventType}`);
641 if (imageUrl && (event.eventType === EventType.NEW_SERIES || event.eventType === EventType.SEASON_START)) {
642 await bot.api.sendPhoto(PRIMARY_CHAT_ID, imageUrl, { caption: messageContent, parse_mode: "HTML" });
643 } else {
644 await bot.api.sendMessage(PRIMARY_CHAT_ID, messageContent, {
645 parse_mode: "HTML",
646 disable_web_page_preview: false,
654 if (BOT_OWNER_ID) {
655 try {
656 await bot.api.sendMessage(
657 BOT_OWNER_ID,
658 `PRIMARY SEND FAIL: ${event.eventType} for ${nameOfManhwa}.\nError: ${e.message.substring(0, 300)}`,
669 log(`Reposting to SECONDARY (${SECONDARY_CHAT_ID}): ${nameOfManhwa} - Event: ${event.eventType}`);
670 if (imageUrl && (event.eventType === EventType.NEW_SERIES || event.eventType === EventType.SEASON_START)) {
671 await bot.api.sendPhoto(SECONDARY_CHAT_ID, imageUrl, { caption: messageContent, parse_mode: "HTML" });
672 } else {
673 await bot.api.sendMessage(SECONDARY_CHAT_ID, messageContent, {
674 parse_mode: "HTML",
675 disable_web_page_preview: false,
681 if (BOT_OWNER_ID) {
682 try {
683 await bot.api.sendMessage(
684 BOT_OWNER_ID,
685 `SECONDARY REPOST FAIL: ${event.eventType} for ${nameOfManhwa} (Primary was OK).\nError: ${
1import { getArticle } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
1import { getArticle, getAuthor } from "./_api.ts";
2import { createServer } from "./_server.ts";
3

graphql-crash-course_api.ts0 matches

@apaleslimghostโ€ขUpdated 2 days ago
1export const getArticle = (id) => ({
2 id,
3 date: new Date().toISOString(),
4 title: "Lorem ipsum",
5 body: "Lorem ipsum dolor sit amet",

github-api1 file match

@cricks_unmixed4uโ€ขUpdated 9 hours ago

beeminder-api4 file matches

@cricks_unmixed4uโ€ขUpdated 10 hours ago
Kapil01
apiv1