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/?q=api&page=646&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 12052 results for "api"(2081ms)

cerebras_codermain.tsx5 matches

@gratitude5deeUpdated 3 months ago
264 } catch (error) {
265 Toastify({
266 text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
267 position: "center",
268 duration: 3000,
1044 };
1045 } else {
1046 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1047 const completion = await client.chat.completions.create({
1048 messages: [
1169 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1170 <title>CerebrasCoder</title>
1171 <link rel="preconnect" href="https://fonts.googleapis.com" />
1172 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1173 <link
1174 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1175 rel="stylesheet"
1176 />
1185 <meta property="og:description" content="Turn your ideas into fully functional apps in less than a second – powered by Llama3.3-70b on Cerebras's super-fast wafer chips. Code is 100% open-source, hosted on Val Town."">
1186 <meta property="og:type" content="website">
1187 <meta property="og:image" content="https://stevekrouse-blob_admin.web.val.run/api/public/CerebrasCoderOG.jpg">
1188
1189

cerebrasTemplateREADME.md6 matches

@rupesh0745Updated 3 months ago
22
231. Sign up for [Cerebras](https://cloud.cerebras.ai/)
242. Get a Cerebras API Key
253. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
26
27Once Cerebras is set up in your Val Town account, there are two ways to get started:
37const { OpenAI } = await import("https://esm.sh/openai");
38const client = new OpenAI({
39 apiKey: Deno.env.get("CEREBRAS_API_KEY"),
40 baseURL: "https://api.cerebras.ai/v1"
41});
42const response = await client.chat.completions.create({
54## Sample apps
55
56* **[Cerebras Searcher](https://www.val.town/v/stevekrouse/cerebras_searcher)** - a Perplexity clone that uses the SerpAPI to do RAG
57and summaries with Cerebras (*requires a SerpAPI key*)
58* **[Cerebras Coder](https://www.val.town/v/stevekrouse/cerebras_coder)** - an app that
59generates websites in a second with Cerebras

cerebrasTemplatemain.tsx5 matches

@rupesh0745Updated 3 months ago
88 // Keep these comments so we remember not to change this
89 const client = new OpenAI({
90 apiKey: Deno.env.get("CEREBRAS_API_KEY"),
91 baseURL: "https://api.cerebras.ai/v1",
92 });
93
101 return Response.json({ message: generatedMessage });
102 } catch (error) {
103 console.error("Error calling Cerebras API:", error);
104
105 if (error.status === 429) {
106 return Response.json({ error: "Cerebras API rate limit reached. Please try again later." }, { status: 429 });
107 } else {
108 return Response.json({ error: `API Error: ${error.message}` }, { status: 500 });
109 }
110 }

cerebrasTemplateREADME.md6 matches

@devin78988Updated 3 months ago
22
231. Sign up for [Cerebras](https://cloud.cerebras.ai/)
242. Get a Cerebras API Key
253. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
26
27Once Cerebras is set up in your Val Town account, there are two ways to get started:
37const { OpenAI } = await import("https://esm.sh/openai");
38const client = new OpenAI({
39 apiKey: Deno.env.get("CEREBRAS_API_KEY"),
40 baseURL: "https://api.cerebras.ai/v1"
41});
42const response = await client.chat.completions.create({
54## Sample apps
55
56* **[Cerebras Searcher](https://www.val.town/v/stevekrouse/cerebras_searcher)** - a Perplexity clone that uses the SerpAPI to do RAG
57and summaries with Cerebras (*requires a SerpAPI key*)
58* **[Cerebras Coder](https://www.val.town/v/stevekrouse/cerebras_coder)** - an app that
59generates websites in a second with Cerebras

cerebrasTemplatemain.tsx5 matches

@devin78988Updated 3 months ago
88 // Keep these comments so we remember not to change this
89 const client = new OpenAI({
90 apiKey: Deno.env.get("CEREBRAS_API_KEY"),
91 baseURL: "https://api.cerebras.ai/v1",
92 });
93
101 return Response.json({ message: generatedMessage });
102 } catch (error) {
103 console.error("Error calling Cerebras API:", error);
104
105 if (error.status === 429) {
106 return Response.json({ error: "Cerebras API rate limit reached. Please try again later." }, { status: 429 });
107 } else {
108 return Response.json({ error: `API Error: ${error.message}` }, { status: 500 });
109 }
110 }

characterGuessermain.tsx1 match

@vawogbemiUpdated 3 months ago
233 const conversationParam = url.searchParams.get("conversation");
234 const { Cerebras } = await import("https://esm.sh/@cerebras/cerebras_cloud_sdk");
235 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
236
237 let conversation = conversationParam ? JSON.parse(decodeURIComponent(conversationParam)) : [];

flowingAmethystHippopotamusmain.tsx24 matches

@gokulnpcUpdated 3 months ago
10const FRAMEWORKS = {
11 "TypeScript": ["Express", "NestJS", "Fastify", "Koa"],
12 "Python": ["Flask", "FastAPI", "Django", "FastAPI"],
13 "JavaScript": ["Express", "Koa", "Fastify", "NestJS"],
14 "Go": ["Gin", "Echo", "Fiber", "Gorilla Mux"],
56}
57
58function APIGenerator() {
59 const [apiDescription, setApiDescription] = useState("");
60 const [language, setLanguage] = useState("TypeScript");
61 const [framework, setFramework] = useState("Express");
70 const handleGenerate = useCallback(async () => {
71 // Validate input
72 if (!apiDescription.trim()) {
73 setError("Please provide an API description");
74 return;
75 }
80 const openai = new OpenAI();
81
82 // Generate API Code
83 const codeCompletion = await openai.chat.completions.create({
84 model: "gpt-4o-mini",
86 {
87 role: "system",
88 content: `You are an expert API developer. Generate a complete, production-ready API implementation.`,
89 },
90 {
91 role: "user",
92 content:
93 `Generate an API in ${language} using ${framework} framework with the following description: ${apiDescription}.
94 Include:
95 1. Complete API implementation
96 2. Proper error handling
97 3. Basic input validation
114 role: "user",
115 content:
116 `Write a complete test suite for the API in ${language} testing all endpoints and scenarios for the following API description: ${apiDescription}.
117 Ensure:
118 1. High test coverage
130 {
131 role: "system",
132 content: `You are an expert technical writer specializing in API documentation.`,
133 },
134 {
135 role: "user",
136 content: `Create comprehensive API documentation for the following API description in ${language}.
137 Include:
138 1. Overview
154 } catch (error) {
155 console.error("Generation error:", error);
156 setError(`Failed to generate API: ${error.message || "Unknown error"}`);
157 } finally {
158 setLoading(false);
159 }
160 }, [apiDescription, language, framework]);
161
162 return (
163 <div className="container mx-auto p-6 max-w-4xl">
164 <h1 className="text-3xl font-bold mb-6 text-center">🚀 API Code Generator</h1>
165
166 <div className="bg-gray-800 p-6 rounded-lg shadow-lg">
171 )}
172 <div className="mb-4">
173 <label className="block text-sm font-bold mb-2">API Description</label>
174 <textarea
175 value={apiDescription}
176 onChange={(e) => setApiDescription(e.target.value)}
177 placeholder="Describe your API (e.g., 'A todo list management API with CRUD operations')"
178 className="w-full p-2 bg-gray-700 text-white rounded"
179 rows={4}
210 <button
211 onClick={handleGenerate}
212 disabled={!apiDescription || loading}
213 className={`w-full p-3 rounded ${
214 !apiDescription || loading
215 ? "bg-gray-500 cursor-not-allowed"
216 : "bg-blue-600 hover:bg-blue-700 text-white"
217 }`}
218 >
219 {loading ? "Generating..." : "Generate API"}
220 </button>
221 </div>
254 return (
255 <div className="min-h-screen bg-gray-900 text-white">
256 <APIGenerator />
257 </div>
258 );
275 <meta charset="UTF-8">
276 <meta name="viewport" content="width=device-width, initial-scale=1.0">
277 <title>API Code Generator</title>
278 <script src="https://cdn.tailwindcss.com"></script>
279 <script src="https://esm.town/v/std/catch"></script>

flowingAmethystHippopotamusREADME.md2 matches

@gokulnpcUpdated 3 months ago
6
71. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`

prosperousYellowMulemain.tsx20 matches

@gokulnpcUpdated 3 months ago
38}
39
40function APIGeneratorApp() {
41 const [prompt, setPrompt] = useState("");
42 const [method, setMethod] = useState("GET");
57
58 try {
59 const response = await fetch("/generate-api", {
60 method: "POST",
61 headers: { "Content-Type": "application/json" },
72 setGeneratedCode(data.code);
73 } catch (error) {
74 console.error("API Generation Error:", error);
75 setGeneratedCode(`Error: ${error.message}`);
76 } finally {
80
81 return (
82 <div className="api-generator-container">
83 <h1>🚀 API Code Generator</h1>
84
85 <div className="input-section">
86 <textarea
87 placeholder="Describe your API endpoint (e.g., 'Create a user registration endpoint')"
88 value={prompt}
89 onChange={(e) => setPrompt(e.target.value)}
113 onChange={(e) => setFramework(e.target.value)}
114 >
115 {['Express.js', 'Next.js', 'FastAPI', 'Gin', 'Rocket'].map(f => (
116 <option key={f} value={f}>{f}</option>
117 ))}
164 return (
165 <ErrorBoundary>
166 <APIGeneratorApp />
167 </ErrorBoundary>
168 );
189
190export default async function server(request: Request): Promise<Response> {
191 if (request.method === "POST" && new URL(request.url).pathname === "/generate-api") {
192 const { OpenAI } = await import("https://esm.sh/openai");
193
201 } = await request.json();
202
203 // Validate API key is set
204 const apiKey = Deno.env.get("CEREBRAS_API_KEY");
205 if (!apiKey) {
206 return new Response(JSON.stringify({
207 code: "// Error: Cerebras API key not configured"
208 }), {
209 status: 500,
213
214 const client = new OpenAI({
215 apiKey: apiKey,
216 baseURL: "https://api.cerebras.ai/v1"
217 });
218
219 const cerebrasPrompt = `Generate a ${generationType} for a ${method} API endpoint in ${language} using ${framework}.
220
221 Endpoint Description: ${prompt}
224 - Use best practices for ${framework}
225 - ${generationType === 'code' ? 'Provide a concise, production-ready implementation' : ''}
226 ${generationType === 'documentation' ? '- Create comprehensive API documentation' : ''}
227 ${generationType === 'tests' ? '- Write comprehensive unit and integration tests' : ''}
228 - Include error handling
243 });
244 } catch (error) {
245 console.error("Cerebras API Error:", error);
246 return new Response(JSON.stringify({
247 code: `// Error generating ${generationType}: ${error.message}`
256 <html>
257 <head>
258 <title>🚀 Cerebras API Generator</title>
259 <meta name="viewport" content="width=device-width, initial-scale=1">
260 <script src="https://esm.town/v/std/catch"></script>
296 }
297
298 .api-generator-container {
299 width: 100%;
300 max-width: 800px;

prosperousYellowMuleREADME.md6 matches

@gokulnpcUpdated 3 months ago
22
231. Sign up for [Cerebras](https://cloud.cerebras.ai/)
242. Get a Cerebras API Key
253. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
26
27Once Cerebras is set up in your Val Town account, there are two ways to get started:
37const { OpenAI } = await import("https://esm.sh/openai");
38const client = new OpenAI({
39 apiKey: Deno.env.get("CEREBRAS_API_KEY"),
40 baseURL: "https://api.cerebras.ai/v1"
41});
42const response = await client.chat.completions.create({
54## Sample apps
55
56* **[Cerebras Searcher](https://www.val.town/v/stevekrouse/cerebras_searcher)** - a Perplexity clone that uses the SerpAPI to do RAG
57and summaries with Cerebras (*requires a SerpAPI key*)
58* **[Cerebras Coder](https://www.val.town/v/stevekrouse/cerebras_coder)** - an app that
59generates websites in a second with Cerebras

social_data_api_project3 file matches

@tsuchi_yaUpdated 1 day ago

simple-scrabble-api1 file match

@bryUpdated 4 days ago
papimark21
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