# इमेज जनरेशन टास्क सबमिट करें

**API:** Model API

**Endpoint:** `POST /api/v1/images/generations`

HTTP 202 के साथ स्थायी task_id लौटाता है। GET /api/v1/images/generations/{task_id} को पोल करें। फ़्लैट input या नेस्टेड input समर्थित है; नेस्टेड input को प्राथमिकता मिलती है। callback फ़ील्ड अनदेखे किए जाते हैं। क्षमताएँ और input पैरामीटर कॉन्फ़िगर किए गए मॉडल और चैनल पर निर्भर करते हैं।

## Base URL

- `https://openapi.felo.ai` — प्रोडक्शन

## Authentication

- `FeloBearerAuth` (http bearer) — Felo API key, `Authorization: Bearer <key>` के रूप में भेजी जाती है।
- `FeloApiKey` (apiKey in header `X-API-Key`) — Felo API key, `X-API-Key: <key>` के रूप में भेजी जाती है।

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `X-Request-Id` | header | no | string | वैकल्पिक caller request ID, जो डायग्नोस्टिक्स के लिए वापस भेजी जाती है। |
| `X-Felo-Channel` | header | no | string, default: "default" | क्रमबद्ध, कॉमा से अलग किए गए सार्वजनिक चैनल कोड। default का उपयोग करने के लिए यह header छोड़ दें; default अकेले ही इस्तेमाल होना चाहिए। वॉलेट मोड में, default मॉडल के प्रभावी सार्वजनिक चैनल क्रम को उल्टे क्रम में स्कैन करता है, अप्रकाशित या अनुपलब्ध चैनल छोड़ देता है, और पहले उपलब्ध चैनल का प्रोवाइडर चुनता है। इसमें उसी upstream मॉडल ID और service tier वाले उस प्रोवाइडर के उपलब्ध endpoints शामिल होते हैं। स्पष्ट रूप से दिए गए चैनल client द्वारा निर्दिष्ट क्रम में सत्यापित होते हैं; केवल पहले चैनल का प्रोवाइडर समूह सबमिट किया जाता है। अन्य प्रोवाइडर पर स्वचालित fallback नहीं होता। पुराने प्रोवाइडर headers चैनल रूटिंग को ओवरराइड नहीं कर सकते। |

## Request body

Required: **yes**

### application/json

Schema: `ImageGenerationRequest` (`#/components/schemas/ImageGenerationRequest`)

```json
{
  "type": "object",
  "required": [
    "model"
  ],
  "properties": {
    "model": {
      "type": "string"
    },
    "prompt": {
      "type": "string"
    },
    "input": {
      "type": "object",
      "additionalProperties": true,
      "description": "वैकल्पिक नेस्टेड input; फ़्लैट input पर प्राथमिकता लेता है।",
      "properties": {
        "input_references": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "image_url"
                ]
              },
              "image_url": {
                "type": "object",
                "additionalProperties": false,
                "oneOf": [
                  {
                    "required": [
                      "url"
                    ]
                  },
                  {
                    "required": [
                      "file_id"
                    ]
                  }
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "minLength": 1,
                    "pattern": "\\S",
                    "not": {
                      "pattern": "^\\s*felo_file_"
                    }
                  },
                  "file_id": {
                    "type": "string",
                    "maxLength": 80,
                    "pattern": "^felo_file_[A-Za-z0-9_-]{1,70}$",
                    "description": "Uploaded Felo file owned by the authenticated user."
                  }
                }
              },
              "role": {
                "type": "string",
                "description": "Optional asset role for models that define reference roles, e.g. refer_image, style_refer_image or subject_refer_image for Kling long images. Other channels reject it."
              }
            },
            "required": [
              "type",
              "image_url"
            ]
          },
          "description": "Reference images by URL/data URI or uploaded Felo file_id. At most 100 Felo references and 50,000,000 bytes per request; model/channel limits may be lower. Keep files until completion."
        },
        "service_tier": {
          "type": [
            "string",
            "null"
          ],
          "default": "default",
          "description": "फ़िलहाल केवल default (standard) समर्थित है। छोड़ा गया, null, उपनाम और असमर्थित स्ट्रिंग्स default पर fallback करते हैं; अन्य प्रकार HTTP 400 लौटाते हैं। कॉन्फ़िगर किए गए चैनल और कीमतें अपरिवर्तित रहती हैं। Text API प्रोवाइडर का standard मान भेजते हैं; Decisions और जनरेशन API upstream फ़ील्ड छोड़ देते हैं।"
        }
      }
    },
    "n": {
      "type": "integer"
    },
    "size": {
      "type": "string",
      "description": "Model-specific size. For supported Gemini token-priced image models, pixel dimensions select the nearest supported aspect ratio only; ignored when aspect_ratio is supplied. Use image_size or resolution for the resolution tier."
    },
    "image_size": {
      "type": "string",
      "enum": [
        "512",
        "1K",
        "2K",
        "4K"
      ],
      "description": "Resolution tier for supported Gemini token-priced image models. Available tiers depend on the model and channel."
    },
    "resolution": {
      "type": "string",
      "description": "Resolution tier; must agree with image_size when both are supplied."
    },
    "aspect_ratio": {
      "type": "string",
      "description": "Output aspect ratio. Supported values depend on the model and channel."
    },
    "provider": {
      "type": "object",
      "required": [
        "options"
      ],
      "additionalProperties": false,
      "properties": {
        "options": {
          "type": "object",
          "minProperties": 1,
          "maxProperties": 1,
          "additionalProperties": {
            "type": "object"
          },
          "description": "Options keyed by the slug published in the model catalog."
        }
      }
    },
    "quality": {
      "type": "string",
      "description": "Model-specific quality or resolution tier. For supported Gemini token-priced models, auto/low map to 1K, medium to 2K and high to 4K, subject to model capabilities. Explicit image_size or resolution takes precedence over these labels. Estimated reservations do not replace actual usage billing."
    },
    "input_references": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image_url"
            ]
          },
          "image_url": {
            "type": "object",
            "additionalProperties": false,
            "oneOf": [
              {
                "required": [
                  "url"
                ]
              },
              {
                "required": [
                  "file_id"
                ]
              }
            ],
            "properties": {
              "url": {
                "type": "string",
                "minLength": 1,
                "pattern": "\\S",
                "not": {
                  "pattern": "^\\s*felo_file_"
                }
              },
              "file_id": {
                "type": "string",
                "maxLength": 80,
                "pattern": "^felo_file_[A-Za-z0-9_-]{1,70}$",
                "description": "Uploaded Felo file owned by the authenticated user."
              }
            }
          },
          "role": {
            "type": "string",
            "description": "Optional asset role for models that define reference roles, e.g. refer_image, style_refer_image or subject_refer_image for Kling long images. Other channels reject it."
          }
        },
        "required": [
          "type",
          "image_url"
        ]
      },
      "description": "Reference images by URL/data URI or uploaded Felo file_id. At most 100 Felo references and 50,000,000 bytes per request; model/channel limits may be lower. Keep files until completion."
    },
    "skill": {
      "type": "string",
      "description": "Long-image type for models that publish it in parameter_definitions, e.g. ecommerce or webpage."
    },
    "length": {
      "type": "string",
      "description": "Page length for long-image models; see applies_when in parameter_definitions for the skills it applies to."
    },
    "service_tier": {
      "type": [
        "string",
        "null"
      ],
      "default": "default",
      "description": "फ़िलहाल केवल default (standard) समर्थित है। छोड़ा गया, null, उपनाम और असमर्थित स्ट्रिंग्स default पर fallback करते हैं; अन्य प्रकार HTTP 400 लौटाते हैं। कॉन्फ़िगर किए गए चैनल और कीमतें अपरिवर्तित रहती हैं। Text API प्रोवाइडर का standard मान भेजते हैं; Decisions और जनरेशन API upstream फ़ील्ड छोड़ देते हैं।"
    }
  },
  "additionalProperties": true,
  "description": "मॉडल-विशिष्ट input कॉन्फ़िगर किए गए सार्वजनिक मॉडल प्रोटोकॉल का पालन करता है।"
}
```

Example:

```json
{
  "model": "configured-image-model",
  "prompt": "a cat"
}
```

## Responses

### 202 — टास्क स्वीकार किया गया

**application/json**

Schema: `ImageGenerationAccepted` (`#/components/schemas/ImageGenerationAccepted`)

### 400 — अमान्य request (अज्ञात मॉडल, मिश्रित input मोड, अमान्य फ़ील्ड)

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 401 — अमान्य या अनुपलब्ध Felo API key

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 402 — अपर्याप्त शेष राशि / बिलिंग आवश्यकता पूरी नहीं हुई

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 403 — खाते को अनुमति नहीं है (सदस्यता आवश्यक है या उपयोगकर्ता पर प्रतिबंध है)। बंद किए गए मॉडल भी upstream कॉल से पहले अस्वीकार कर दिए जाते हैं। पहले से स्वीकृत requests और टास्क जारी रहते हैं।

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 429 — request या खर्च सीमा पूरी हो गई

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 502 — upstream प्रोवाइडर विफल रहा

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

### 503 — जनरेशन सेवा या बिलिंग सेवा अस्थायी रूप से उपलब्ध नहीं है

**application/json**

Schema: `GenerationError` (`#/components/schemas/GenerationError`)

## Schema definitions

### GenerationError

`#/components/schemas/GenerationError`

```json
{
  "type": "object",
  "description": "OpenAI-संगत एरर एनवेलप।",
  "properties": {
    "error": {
      "type": "object",
      "required": [
        "message",
        "type"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "invalid_request_error",
            "server_error"
          ]
        },
        "param": {
          "type": "string",
          "nullable": true
        },
        "code": {
          "type": "string"
        }
      }
    }
  }
}
```

### ImageGenerationAccepted

`#/components/schemas/ImageGenerationAccepted`

```json
{
  "type": "object",
  "required": [
    "task_id",
    "status",
    "kind",
    "outputs"
  ],
  "properties": {
    "task_id": {
      "type": "string",
      "description": "पोलिंग के लिए उपयोग करने वाला टास्क ID।"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued"
      ]
    },
    "kind": {
      "type": "string",
      "enum": [
        "image"
      ]
    },
    "outputs": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "string",
            "format": "uri"
          },
          {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "watermark_url": {
                "type": "string",
                "format": "uri",
                "nullable": true,
                "description": "Optional watermarked version of this image."
              },
              "b64_json": {
                "type": "string"
              }
            }
          }
        ]
      },
      "description": "टास्क सफल होने तक खाली।"
    }
  }
}
```
