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=928&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 13254 results for "api"(2123ms)

htmlToMarkdownConvertermain.tsx1 match

@willowUpdated 6 months ago
114 <title>HTML to Markdown Converter (with Table and Link Support)</title>
115 <meta name="viewport" content="width=device-width, initial-scale=1">
116 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap" rel="stylesheet">
117 <style>${css}</style>
118 </head>

sqliteExplorerAppREADME.md1 match

@jaipUpdated 6 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

sqliteExplorerAppmain.tsx2 matches

@jaipUpdated 6 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

xmasRedHamstermain.tsx2 matches

@trollishkaUpdated 6 months ago
27
28async function getMostPopularPinterestImage(query: string): Promise<string> {
29 const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30 const response = await fetch(searchUrl, {
31 headers: {
36
37 if (!response.ok) {
38 throw new Error(`Pinterest API request failed: ${response.statusText}`);
39 }
40

xmasRedHamstermain.tsx2 matches

@stevekrouseUpdated 6 months ago
27
28async function getMostPopularPinterestImage(query: string): Promise<string> {
29 const searchUrl = `https://api.pinterest.com/v5/search/pins?query=${encodeURIComponent(query)}&page_size=50&sort_order=popularity`;
30 const response = await fetch(searchUrl, {
31 headers: {
36
37 if (!response.ok) {
38 throw new Error(`Pinterest API request failed: ${response.statusText}`);
39 }
40

tokencountermain.tsx36 matches

@prashamtrivediUpdated 6 months ago
10 const [modelFamily, setModelFamily] = useState("Anthropic");
11 const [tokenCount, setTokenCount] = useState(null);
12 const [anthropicApiKey, setAnthropicApiKey] = useState("");
13 const [geminiApiKey, setGeminiApiKey] = useState("");
14 const [isLoading, setIsLoading] = useState(false);
15
16 useEffect(() => {
17 const storedAnthropicKey = localStorage.getItem("anthropicApiKey");
18 const storedGeminiKey = localStorage.getItem("geminiApiKey");
19 if (storedAnthropicKey) setAnthropicApiKey(storedAnthropicKey);
20 if (storedGeminiKey) setGeminiApiKey(storedGeminiKey);
21 }, []);
22
23 const saveApiKey = (key, value) => {
24 localStorage.setItem(key, value);
25 };
26
27 const handleApiKeyChange = (e, setFunction, storageKey) => {
28 const value = e.target.value;
29 setFunction(value);
30 saveApiKey(storageKey, value);
31 };
32
33 const countTokens = async () => {
34 if (modelFamily === "Anthropic" && anthropicApiKey) {
35 try {
36 const response = await fetch("/api/count-tokens", {
37 method: "POST",
38 headers: {
40 },
41 body: JSON.stringify({
42 apiKey: anthropicApiKey,
43 systemPrompt,
44 userPrompt,
55 return 0;
56 }
57 } else if (modelFamily === "Google Gemini" && geminiApiKey) {
58 try {
59 const genAI = new GoogleGenerativeAI(geminiApiKey);
60 const modelOptions = {
61 model: "models/gemini-1.5-pro",
83 }
84 } else {
85 // Fallback to simple word count when API keys are not available
86 return (systemPrompt + userPrompt + tools).split(/\s+/).length;
87 }
95 }
96
97 if (modelFamily === "Anthropic" && !anthropicApiKey) {
98 alert("Please provide your Anthropic API key.");
99 return;
100 }
101
102 if (modelFamily === "Google Gemini" && !geminiApiKey) {
103 alert("Please provide your Google Gemini API key.");
104 return;
105 }
111 } catch (error) {
112 console.error("Error:", error);
113 alert("An error occurred while processing your request. Please check your API key and try again.");
114 } finally {
115 setIsLoading(false);
169 {modelFamily === "Anthropic" && (
170 <div>
171 <label htmlFor="anthropicApiKey" className="block text-purple-300 mb-2">Anthropic API Key:</label>
172 <input
173 type="password"
174 id="anthropicApiKey"
175 value={anthropicApiKey}
176 onChange={(e) => handleApiKeyChange(e, setAnthropicApiKey, "anthropicApiKey")}
177 placeholder="Enter your Anthropic API key"
178 className="w-full p-2 bg-gray-700 text-white rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"
179 />
182 {modelFamily === "Google Gemini" && (
183 <div>
184 <label htmlFor="geminiApiKey" className="block text-purple-300 mb-2">Google Gemini API Key:</label>
185 <input
186 type="password"
187 id="geminiApiKey"
188 value={geminiApiKey}
189 onChange={(e) => handleApiKeyChange(e, setGeminiApiKey, "geminiApiKey")}
190 placeholder="Enter your Google Gemini API key"
191 className="w-full p-2 bg-gray-700 text-white rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"
192 />
225 const url = new URL(request.url);
226
227 if (url.pathname === "/api/count-tokens") {
228 if (request.method !== "POST") {
229 return new Response("Method Not Allowed", { status: 405 });
231
232 const { Anthropic } = await import("https://esm.sh/@anthropic-ai/sdk");
233 const { apiKey, systemPrompt, userPrompt, tools } = await request.json();
234
235 const anthropic = new Anthropic({ apiKey });
236 const countRequest = {
237 betas: ["token-counting-2024-11-01"],
264 }
265
266 if (url.pathname === "/api/generate-anthropic") {
267 if (request.method !== "POST") {
268 return new Response("Method Not Allowed", { status: 405 });
270
271 const { Anthropic } = await import("https://esm.sh/@anthropic-ai/sdk");
272 const { apiKey, systemPrompt, userPrompt } = await request.json();
273
274 const anthropic = new Anthropic({ apiKey });
275
276 try {

weatherDashboardmain.tsx3 matches

@oioioiUpdated 6 months ago
3import { createRoot } from "https://esm.sh/react-dom/client";
4
5const API_BASE_URL = "https://api.open-meteo.com/v1/forecast";
6
7const weatherIcons = {
34 async function fetchWeatherData(city) {
35 try {
36 const response = await fetch(`${API_BASE_URL}?latitude=40.71&longitude=-74.01&daily=weathercode,temperature_2m_max,temperature_2m_min,precipitation_probability_max&current_weather=true&timezone=auto&forecast_days=7`);
37 const data = await response.json();
38 setWeatherData(data);
126
127const css = `
128@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');
129
130body {

generateframeImagemain.tsx5 matches

@stevekrouseUpdated 6 months ago
5async function getWeather(latitude: number, longitude: number) {
6 const url =
7 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current_weather=true&temperature_unit=fahrenheit`;
8 try {
9 const response = await fetch(url);
10 if (!response.ok) {
11 throw new Error(`Weather API responded with status: ${response.status}`);
12 }
13 const data = await response.json();
143
144async function generateImage(html: string): Promise<Response> {
145 const apiKey = Deno.env.get("API_FLASH_KEY");
146 const encodedHtml = encodeURIComponent(html);
147 const url =
148 `https://api.apiflash.com/v1/urltoimage?access_key=${apiKey}&url=https://michaelwschultz-generateframeimage.web.val.run&width=800&height=480&format=png&fresh=true`;
149
150 try {
151 const response = await fetch(url);
152 if (!response.ok) {
153 throw new Error(`APIFlash responded with status: ${response.status}`);
154 }
155 return response;

sqlitemain.tsx4 matches

@oioioiUpdated 6 months ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2import { LibsqlError, type ResultSet, type Row, type TransactionMode } from "npm:@libsql/client";
3import { z } from "npm:zod";
35
36async function execute(statement: InStatement, args?: InArgs): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
50
51async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
52 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
53 method: "POST",
54 headers: {
78
79/* Val Town's Turso Proxy returns rows as an array of values
80 * Yet the LibSQL API has a Row type which behave as an array or object,
81 * ie you can access it via numerical index or string
82 */

simpleWikipediaInstantSearchmain.tsx2 matches

@maxmUpdated 6 months ago
44 <meta name="viewport" content="width=device-width, initial-scale=1.0">
45 <title>Simple Wikipedia Instant Search</title>
46 <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
47 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
48 <style>
49 body {

vapi-minutes-db1 file match

@henrywilliamsUpdated 3 days ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 3 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