1👕 **Shirtgen API Endpoint**
2
3Shirtgen lets you generate AI-powered t-shirt designs with just a prompt! 🖋️ Choose between the standard "Flux Schnell" model or the enhanced "Pro" model. Perfect for creating unique custom apparel in seconds! 🚀
13 }
14
15 const REPLICATE_API_KEY = Deno.env.get("REPLICATE_API_KEY");
16
17 if (REPLICATE_API_KEY) {
18 const modelVersion = useProModel ? "black-forest-labs/flux-1.1-pro" : "black-forest-labs/flux-schnell";
19 const settings = {
20 outputFormat: "jpg",
21 outputQuality: 90,
22 megapixels: "1",
23 };
24
25 console.log("Sending initial request to Replicate...");
26 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
27 method: "POST",
28 headers: {
29 "Content-Type": "application/json",
30 "Authorization": `Bearer ${REPLICATE_API_KEY}`,
31 },
32 body: JSON.stringify({
36 output_quality: settings.outputQuality,
37 disable_safety_checker: true,
38 megapixels: settings.megapixels,
39 },
40 }),
49 const resultResponse = await fetch(prediction.urls.get, {
50 headers: {
51 "Authorization": `Token ${REPLICATE_API_KEY}`,
52 },
53 });
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
5async function getWeather(latitude: number, longitude: number) {
6 const url =
7 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t_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;
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 {
47 <pre><code id="resultCode"></code></pre>
48 </div>
49 <h2>API Documentation</h2>
50 <p>To use the POST endpoint programmatically, send a POST request to this URL with the TypeScript code in the request body.</p>
51 <h3>Curl Example:</h3>
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }
16 <meta name="viewport" content="width=device-width, initial-scale=1.0">
17 <title>${blogTitle}</title>
18 <link rel="preconnect" href="https://fonts.googleapis.com">
19 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
20 <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
21 <style>
22 @view-transition { navigation: auto; }
20
21 try {
22 // First API call - Get search results
23 const searchResult = await fetch("/api/search", {
24 method: "POST",
25 headers: { "Content-Type": "application/json" },
30 setSources(searchData.sources);
31
32 // Second API call - Get summary
33 setSummaryLoading(true);
34 const summaryResult = await fetch("/api/summarize", {
35 method: "POST",
36 headers: { "Content-Type": "application/json" },
121 const url = new URL(req.url);
122
123 if (url.pathname === "/api/search") {
124 const { query } = await req.json();
125
126 // Search using SerpApi
127 const searchResponse = await fetch(
128 `https://serpapi.com/search.json?q=${encodeURIComponent(query)}&api_key=${Deno.env.get("SERP_API_KEY")}`,
129 );
130
144 }
145
146 if (url.pathname === "/api/summarize") {
147 const { query, searchData } = await req.json();
148 const sources = searchData.sources;
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`
10
11Migrated from folder: Archive/cerebras_debater