Kuvan luominen
Luo ja muokkaa kuvia yhdellä OpenAI-yhteensopivalla päätepisteellä. Sama pyyntömuoto tavoittaa luettelon jokaisen kuvamallin.
Yksi OpenAI-yhteensopiva kuva-endpoint jakautuu Fluxiin, Nano-Bananaan, Waniin ja muihin tarjoajiin. Lähetä sama request-muoto upstreamista riippumatta; tarjoajakohtaiset asetukset välitetään läpi ja validoidaan kunkin mallin kyvykkyyksiä vasten.
Löydä kuvamallit listaamalla models-endpoint ja säilyttämällä ne, joiden output modalities sisältää imagen.
POST /v1/images/generations
Drop-in yhteensopiva OpenAI:n kanssa images.generate SDK. Palveluntarjoajakohtaiset parametrit elävät vakioparametrien rinnalla – taustajärjestelmä välittää sen, minkä kukin malli ymmärtää.
https://api.airforce/v1/images/generationsKuvamallit
…· liveYleiset parametrit
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Image model ID. Find them on /v1/models: image models carry media_type: "image" and an image_caps block. |
| prompt | string | Required | Image description. |
| n | integer | Optional | Number of variations to generate per request. Capped by the model's image_caps.max_n. |
| size | string | Optional | OpenAI-style WxH, e.g. "1024x1024". Provider-specific values pass through. |
| aspect_ratio | string | Optional | Alternative to size. "16:9", "1:1", "9:16", … Validated against image_caps.aspect_ratios. |
| quality | string | Optional | "standard" | "hd" (OpenAI) or model-specific labels. Validated. |
| response_format | string | Optional | "url" (default) or "b64_json". |
| seed | integer | Optional | Reproducibility seed. Same prompt + same seed = same image (where the upstream supports it). |
| input_images | array | Optional | [{ url? } | { b64_json? }] for image-to-image / reference / first-frame. |
| sse | boolean | Optional | When true the response is sent as Server-Sent Events. The full JSON arrives in one event followed by [DONE]. Useful to keep long upstream renders from timing out at proxies. |
Perusesimerkki
curl https://api.airforce/v1/images/generations \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"prompt": "A cute baby sea otter floating on its back",
"n": 1,
"response_format": "url"
}'Vastauksen muoto
| Parameter | Type | Required | Description |
|---|---|---|---|
| created | integer | Optional | Unix timestamp. |
| data | array | Optional | Generated assets. |
| data[].url | string | Optional | Image URL when response_format is "url" (default). The image is re-hosted to a file host and the link ends in /image.jpeg; null if the re-host fails. |
| data[].b64_json | string | Optional | Base64-encoded image bytes when response_format is "b64_json". The format follows the upstream provider (often JPEG), not necessarily PNG. |
{
"created": 1715000000,
"data": [{
"url": "https://.../image.jpeg"
}]
}Suoratoistoversio
Syöttö sse: true kun välityspalvelinta käytetään väliohjelmiston kautta, jolla on tiukat valmiusaikakatkaisut. Vastaus on sitten yksi SSE-tapahtuma, jossa on täydellinen JSON [DONE].
data: {"created":1715000000,"data":[{"url":"https://.../image.jpeg"}]}
data: [DONE]Kuvasta kuvaksi ja viittaus
Mallit, joissa image_caps.max_input_images > 0 hyväksyä viitekuvat. Joko välittää URL-osoitteita tai base64-koodattuja tietoja.
curl https://api.airforce/v1/images/generations \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"prompt": "Same character, now in a snowy forest",
"aspect_ratio": "16:9",
"input_images": [
{"url": "https://example.com/character.jpg"}
]
}'Kuvien muokkaus
OpenAI-yhteensopiva muokkaus-endpoint. Lähetä lähdekuva multipart-tiedostona, kuten OpenAI:n SDK:t tekevät images.edit-kutsussa, tai lähetä yllä näytetty JSON-runko input_images-kentällä. Se kulkee samaa reittiä kuin /v1/images/generations: samat mallit, hinnat ja vastausmuoto.
https://api.airforce/v1/images/edits| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | An image model with image_caps.max_input_images > 0 (see Discovering capabilities below). |
| prompt | string | Required | What to change or create from the input image(s). |
| image | file | Required | The source image. Repeat as image[] for several references; images, images[] and input_images are accepted too, as files or as image URLs. |
| mask | file | Optional | Forwarded as is, but no listed model declares mask support, so the serving model may ignore it. |
| n | integer | Optional | Number of images to generate. |
| size | string | Optional | Output size, e.g. "1024x1024", where the model supports it. |
| aspect_ratio | string | Optional | Output aspect ratio, e.g. "16:9", where the model supports it. |
| quality | string | Optional | Model-specific quality level. |
| response_format | string | Optional | "url" or "b64_json", as on /v1/images/generations. |
curl https://api.airforce/v1/images/edits \
-H "Authorization: Bearer sk-air-YOUR_API_KEY" \
-F "model=nano-banana-2" \
-F "prompt=Same character, now in a snowy forest" \
-F "[email protected]" \
-F "aspect_ratio=16:9"from openai import OpenAI
client = OpenAI(base_url="https://api.airforce/v1", api_key="sk-air-YOUR_API_KEY")
with open("character.png", "rb") as image:
result = client.images.edit(
model="nano-banana-2",
image=image,
prompt="Same character, now in a snowy forest",
)
print(result.data[0].url)Enintään 16 syötekuvaa pyyntöä kohden, kukin 25 Mt; mallin oma raja on image_caps.max_input_images. Pyyntö ilman syötekuvaa hylätään koodilla 400 sen sijaan, että siitä tulisi teksti kuvaksi -kutsu. Jokainen syötekuva voi nostaa hintaa mallisivun mukaisesti.
Mallikohtaiset parametrit
Yllä olevien yleisten parametrien lisäksi yksittäiset malliperheet hyväksyvät lisävarusteita. Tuntemattomat parametrit välitetään ylävirran puolelle sellaisenaan, joten kaikki tulevat toimittajakohtaiset nupit toimivat myös ilman SDK-päivitystä.
Nano-Banana
nano-banana-2, nano-banana-pro
| Parameter | Type | Required | Description |
|---|---|---|---|
| aspect_ratio | string | Optional | "1:1", "16:9", "9:16", "4:3". |
| resolution | string | Optional | "512", "1024", "2048". |
| image_urls | array | Optional | Reference images. |
Suno (music)
suno-v4.5, suno-v5 ja suno-v5.5 hyväksyttiin aiemmin tällä endpointilla. Ne kuuluvat nyt natiiviin musiikki-APIin osoitteessa /v1/audio/music — kutsut tänne hylätään virheellä `wrong_endpoint`.
Ominaisuuksien löytäminen
Jokainen kuvamalli valottaa image_caps päällä /v1/models jotta asiakkaat voivat vahvistaa syötteet ennen lähettämistä:
| Parameter | Type | Required | Description |
|---|---|---|---|
| image_caps.max_n | integer | Optional | Maximum n per request. |
| image_caps.aspect_ratios | array | Optional | Allowed aspect_ratio values. |
| image_caps.qualities | array | Optional | Allowed quality values. |
| image_caps.max_input_images | integer | Optional | 0 = text-only model. Higher = supports reference images. |
| image_caps.supports_url_input | boolean | Optional | Whether input_images may be passed as URLs (vs base64). |
| image_caps.supports_seed | boolean | Optional | Whether the model honours a seed value (most scraping-proxy upstreams ignore it). |
Kuvien hinnoittelu ei ole kentässä image_caps — käytä mallin hintakenttiä endpointilla /v1/models kustannuksen selvittämiseen.