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=945&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 13019 results for "api"(1774ms)

faviconGeneratormain.tsx5 matches

@iamseeley•Updated 8 months ago
1// This approach will use the fal.ai API to generate a custom favicon based on a user-provided prompt.
2// The favicon will be displayed on the page for the user to download.
3
97 if (!response.ok) {
98 const errorText = await response.text();
99 console.error("fal.ai API error:", response.status, response.statusText, errorText);
100 throw new Error(`Failed to generate image: ${response.status} ${response.statusText}`);
101 }
102
103 const data = await response.json();
104 console.log("API response:", data);
105
106 if (!data.images || data.images.length === 0 || !data.images[0].url) {
107 console.error("Unexpected API response format:", data);
108 throw new Error("Unexpected API response format");
109 }
110

valWallmain.tsx1 match

@yawnxyz•Updated 8 months ago
6import dayjs from "npm:dayjs";
7
8// import { getVals, getValsWithVersions } from "./api.js";
9import { getVals, getValsWithVersions } from "https://esm.town/v/yawnxyz/valVersions";
10

dbpediaenhancedmain.tsx8 matches

@ejfox•Updated 8 months ago
63 setError(null);
64 try {
65 const response = await fetch(`/api/search?query=${encodeURIComponent(searchQuery)}`);
66 if (!response.ok) {
67 throw new Error(`HTTP error! status: ${response.status}`);
198 "div",
199 { className: "mt-8 bg-gray-100 p-4 rounded-md" },
200 React.createElement("h3", { className: "text-lg font-semibold mb-2" }, "API Endpoints:"),
201 React.createElement(
202 "pre",
203 { className: "bg-gray-200 p-2 rounded text-sm overflow-x-auto" },
204 `Search API: GET /api/search?query=your_query
205Raw JSON: GET /api/raw?query=your_query`
206 ),
207 React.createElement("h3", { className: "text-lg font-semibold mt-4 mb-2" }, "cURL Example:"),
209 "pre",
210 { className: "bg-gray-200 p-2 rounded text-sm overflow-x-auto" },
211 `curl 'https://ejfox-dbpediaenhanced.web.val.run/api/search?query=${encodeURIComponent(query || "example")}'`
212 )
213 )
223async function fetchDBpediaResults(query: string) {
224 const lookupResponse = await fetch(
225 `https://lookup.dbpedia.org/api/search?query=${encodeURIComponent(query)}&format=json&maxResults=10`
226 );
227 const lookupData = await lookupResponse.json();
245 const query = url.searchParams.get("query");
246
247 if (path === "/api/search" || path === "/api/raw") {
248 if (!query) {
249 return new Response("Query parameter is required", { status: 400 });
253 const results = await fetchDBpediaResults(query);
254
255 if (path === "/api/raw") {
256 return new Response(JSON.stringify(results, null, 2), {
257 headers: { "Content-Type": "application/json" },

dbpediaenhancedREADME.md1 match

@ejfox•Updated 8 months ago
1An API and basic interface for entity searching from DBPedia, enhanced with images

dbpediamain.tsx6 matches

@ejfox•Updated 8 months ago
1// This tool uses the DBpedia Lookup API and SPARQL endpoint to find entities and their details, including images.
2// It provides a web interface and a JSON API endpoint for entity search, including hero images.
3
4// Helper function to strip HTML tags and decode HTML entities
29
30 const fetchResults = async (searchQuery) => {
31 const response = await fetch(`/api/search?query=${encodeURIComponent(searchQuery)}`);
32 const data = await response.json();
33 setResults(data);
113 "pre",
114 { className: "bg-gray-200 p-2 rounded text-sm overflow-x-auto" },
115 `curl 'https://ejfox-dbpedia.web.val.run/api/search${query ? `?query=${encodeURIComponent(query)}` : ''}'`
116 )
117 )
127async function fetchDBpediaResults(query: string) {
128 const lookupResponse = await fetch(
129 `https://lookup.dbpedia.org/api/search?query=${encodeURIComponent(query)}&format=json&maxResults=5`,
130 );
131 const lookupData = await lookupResponse.json();
165 const path = url.pathname;
166
167 if (path === "/api/search") {
168 const query = url.searchParams.get("query");
169 if (!query) {

dbpediaREADME.md1 match

@ejfox•Updated 8 months ago
1An API and basic interface for entity searching from DBPedia, enhanced with images

oraclemain.tsx1 match

@blur•Updated 8 months ago
24 role: "user",
25 content: e.text
26 + "\nDodatkowo napisz krótki wiersz o Olafie jakim świetnym jest programistą",
27 },
28 ],

prepareChapterForAlgoliamain.tsx2 matches

@willthereader•Updated 8 months ago
405Who had legal authority over Dragon?
406
407"You don't have to ask stupid questions," Forecast suggested. "You're smart enough to figure out what was going on. Why Dragon was afraid of being used. Why Taylor and Veda were working with Armsmaster to set her free." She paused, a hiss escaping her breath from wherever she was. "No one deserves to be a slave, to be used for what they are with no care for who they are."
408
409The PRT. No, the Triumvirate. "You're saying Alexandria knew."
778She'd already hired constitutional lawyers, she said? For something unrelated to herself.
779
780"You're going to try and get them out, aren't you?" Chambers downed his drink rapidly. "Well. Good luck with that, but I'll warn you now that no one likes watching criminals go free, even if they have a sad story."
781
782"I do not need to find a way to let them out," Veda declared. "I already possess one."

dotShortcutmain.tsx1 match

@pomdtr•Updated 8 months ago
12 const [author, name] = subdomain.split("-");
13
14 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
15 if (!resp.ok) {
16 console.error("failed to fetch val infos");

OpenAImain.tsx7 matches

@hash0000ff•Updated 8 months ago
2
3/**
4 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
5 */
6export class OpenAI {
8
9 /**
10 * API Client for interfacing with the OpenAI API. Uses Val Town credentials.
11 *
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
17 * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
18 * @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
19 */
20 constructor(options: Omit<ClientOptions, "baseURL" | "apiKey" | "organization"> = {}) {
21 this.rawOpenAIClient = new RawOpenAI({
22 ...options,
23 baseURL: "https://std-openaiproxy.web.val.run/v1",
24 apiKey: Deno.env.get("valtown"),
25 organization: null,
26 });

vapi-minutes-db1 file match

@henrywilliams•Updated 2 days ago

vapi-minutes-db2 file matches

@henrywilliams•Updated 2 days ago
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com