11[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
12
13It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
14
15# TODO
425 if (url.pathname === "/create-checkout-session" && req.method === "POST") {
426 const stripe = new Stripe(Deno.env.get("STRIPE_SECRET_KEY"), {
427 apiVersion: "2022-11-15",
428 });
429
464
465 const stripe = new Stripe(Deno.env.get("STRIPE_SECRET_KEY"), {
466 apiVersion: "2022-11-15",
467 });
468
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
8 return response.json();
9To use it on your own Val Town SQLite database, [fork it](https://www.val.town/v/stevekrouse/sqlite_admin/fork) to your account.
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
162. The user selects the appropriate language from the dropdown menu
173. When the "Add Comments" button is clicked, the code is sent to the server
184. The server uses OpenAI's API to generate comments for the code
195. The commented code is returned and displayed in the right panel with syntax highlighting
20
28- Deno: Runtime environment
29- Val Town: Hosting platform
30- OpenAI API: For generating code comments
31
32## Usage
41## Limitations
42
43- The maximum length of code that can be processed is limited by the OpenAI API's token limit
44- The quality of comments may vary depending on the complexity of the code and the AI model's capabilities
45- Internet connection is required to use the application
8
91. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
123 }
124
125 const REPLICATE_API_KEY = Deno.env.get("REPLICATE_API_KEY");
126
127 if (REPLICATE_API_KEY) {
128 const modelVersion = useProModel ? "black-forest-labs/flux-1.1-pro" : "black-forest-labs/flux-schnell";
129 const settings = {
130 outputFormat: "jpg",
131 outputQuality: 90,
132 megapixels: "1",
133 };
134
135 console.log("Sending initial request to Replicate...");
136 const response = await fetch(`https://api.replicate.com/v1/models/${modelVersion}/predictions`, {
137 method: "POST",
138 headers: {
139 "Content-Type": "application/json",
140 "Authorization": `Bearer ${REPLICATE_API_KEY}`,
141 },
142 body: JSON.stringify({
146 output_quality: settings.outputQuality,
147 disable_safety_checker: true,
148 megapixels: settings.megapixels,
149 },
150 }),
159 const resultResponse = await fetch(prediction.urls.get, {
160 headers: {
161 "Authorization": `Token ${REPLICATE_API_KEY}`,
162 },
163 });
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! ๐
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! ๐