generate_image
Create images from text prompts using FLUX.1 Schnell AI, with Lightning Network payment integration for micro-transactions.
Instructions
Generate an image from a text prompt using FLUX.1 Schnell (12B). Costs 100 sats via Lightning L402.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | Description of the image to generate | |
| payment_hash | No | Payment hash if retrying after L402 payment |
Implementation Reference
- src/index.ts:106-120 (handler)The handler for 'generate_image' which sends a request to the API and handles L402 payment requirements.
server.tool( "generate_image", "Generate an image from a text prompt using FLUX.1 Schnell (12B). Costs 100 sats via Lightning L402.", { prompt: z.string().describe("Description of the image to generate"), payment_hash: z.string().optional().describe("Payment hash if retrying after L402 payment"), }, async ({ prompt, payment_hash }) => { const data = await l402Post(MAXIMUMSATS_API, "/api/imagegen", { prompt }, payment_hash); if (data.image) { return textResult(`Image generated. Base64 PNG (${data.image.length} chars). Model: ${data.model || "flux-1-schnell"}`); } return textResult(data.result || formatL402(data)); } );