2024-03-26 02:17:45 +00:00
|
|
|
{
|
|
|
|
"components": {
|
|
|
|
"securitySchemes": {
|
2025-04-29 07:25:14 +00:00
|
|
|
"apiKeyAuth": {
|
2024-03-26 02:17:45 +00:00
|
|
|
"type": "apiKey",
|
2025-04-29 07:25:14 +00:00
|
|
|
"in": "header",
|
|
|
|
"name": "X-Api-Key",
|
|
|
|
"description": "API Key for authentication"
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"info": {
|
2025-04-29 07:25:14 +00:00
|
|
|
"title": "AI Image Generator",
|
|
|
|
"version": "1.0.0",
|
|
|
|
"description": "Generate images using Cloudflare Workers AI's @cf/black-forest-labs/flux-1-schnell model"
|
2024-03-26 02:17:45 +00:00
|
|
|
},
|
|
|
|
"openapi": "3.0.0",
|
|
|
|
"paths": {
|
2025-04-29 07:25:14 +00:00
|
|
|
"/": {
|
|
|
|
"post": {
|
|
|
|
"summary": "Generate Image",
|
|
|
|
"operationId": "generateImage",
|
|
|
|
"description": "Generate an image based on text prompt using Cloudflare Workers AI's flux-1-schnell model",
|
|
|
|
"requestBody": {
|
|
|
|
"required": true,
|
|
|
|
"content": {
|
|
|
|
"application/json": {
|
|
|
|
"schema": {
|
|
|
|
"type": "object",
|
|
|
|
"required": ["prompt"],
|
|
|
|
"properties": {
|
|
|
|
"prompt": {
|
|
|
|
"type": "string",
|
|
|
|
"description": "Text description of the image you want to generate(English only)",
|
|
|
|
"minLength": 1,
|
|
|
|
"maxLength": 2048
|
|
|
|
},
|
|
|
|
"steps": {
|
|
|
|
"type": "integer",
|
|
|
|
"description": "The number of diffusion steps; higher values can improve quality but take longer",
|
|
|
|
"default": 4,
|
|
|
|
"minimum": 1,
|
|
|
|
"maximum": 8
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
2025-04-29 07:25:14 +00:00
|
|
|
},
|
2024-03-26 02:17:45 +00:00
|
|
|
"responses": {
|
|
|
|
"200": {
|
2025-04-29 07:25:14 +00:00
|
|
|
"description": "Successfully generated image",
|
2024-03-26 02:17:45 +00:00
|
|
|
"content": {
|
2025-04-29 07:25:14 +00:00
|
|
|
"image/png": {
|
2024-03-26 02:17:45 +00:00
|
|
|
"schema": {
|
2025-04-29 07:25:14 +00:00
|
|
|
"type": "string",
|
|
|
|
"format": "binary",
|
|
|
|
"description": "Generated image data"
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2025-04-29 07:25:14 +00:00
|
|
|
},
|
|
|
|
"400": {
|
|
|
|
"description": "Invalid request parameters"
|
|
|
|
},
|
|
|
|
"401": {
|
|
|
|
"description": "Unauthorized, invalid API key"
|
|
|
|
},
|
|
|
|
"500": {
|
|
|
|
"description": "Server error"
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"security": [
|
|
|
|
{
|
2025-04-29 07:25:14 +00:00
|
|
|
"apiKeyAuth": []
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"security": [
|
|
|
|
{
|
2025-04-29 07:25:14 +00:00
|
|
|
"apiKeyAuth": []
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"servers": [
|
|
|
|
{
|
2025-04-29 07:25:14 +00:00
|
|
|
"url": "https://schnell-worker.foryoung365.workers.dev",
|
|
|
|
"description": "Cloudflare Worker for Image Generation"
|
2024-03-26 02:17:45 +00:00
|
|
|
}
|
|
|
|
]
|
2024-04-15 16:13:41 +00:00
|
|
|
}
|