91 }
92
93 const REPLICATE_API_KEY = Deno.env.get("REPLICATE_API_KEY");
94
95 if (REPLICATE_API_KEY) {
96 const modelVersion = useProModel ? "black-forest-labs/flux-1.1-pro" : "black-forest-labs/flux-schnell";
97 const settings = {
98 outputFormat: "jpg",
99 outputQuality: 90,
100 megapixels: "1",
101 };
102
103 console.log("Sending initial request to Replicate...");
104 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
105 method: "POST",
106 headers: {
107 "Content-Type": "application/json",
108 "Authorization": `Bearer ${REPLICATE_API_KEY}`,
109 },
110 body: JSON.stringify({
114 output_quality: settings.outputQuality,
115 disable_safety_checker: true,
116 megapixels: settings.megapixels,
117 },
118 }),
127 const resultResponse = await fetch(prediction.urls.get, {
128 headers: {
129 "Authorization": `Token ${REPLICATE_API_KEY}`,
130 },
131 });
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! ๐
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 });
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 });
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 });
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! ๐
9
10## Image Generation Sources
11- **With Replicate API Key**: Uses **Replicate Hosted Flux models** for high-quality designs.
12- **Without Replicate Key**: Falls back to a Val.town image generator for quick designs.
13
14## Requirements
15- **Optional Replicate API Key**: To use the advanced models, set `REPLICATE_API_KEY` in your environment.
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 */