Skip to main content

Image Generation and Editing

Orbit AI API Team2026/07/116 min read

Orbit AI API provides OpenAI-compatible image endpoints for generation and editing. Point the Base URL to Orbit AI API and use an API key created in the console.

Connection parameters

ParameterValue
Base URLhttps://orbitaiapi.site/v1
AuthenticationAuthorization: Bearer YOUR_API_KEY
ModelExact name shown in the console, such as gpt-image-2, gpt-image-2-all, or a Gemini image model

Image generation

Endpoint: POST /v1/images/generations

cURL example

curl -X POST "https://orbitaiapi.site/v1/images/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A premium product poster with a clean background and realistic photography style",
"size": "1024x1024",
"quality": "auto",
"n": 1,
"response_format": "url"
}'

Request fields

FieldRequiredDescription
modelRequiredImage model name, such as gpt-image-2, gpt-image-2-all, or a Gemini image model.
promptRequiredDescription of the image to generate.
sizeOptionalCommon GPT sizes: 1024x1024, 1536x1024, 1024x1536. Gemini images may accept aspect ratios or model-specific sizes.
qualityOptionalCommon values: auto, low, high, 2K, 4K. Support varies by model.
nOptionalNumber of images to generate. Usually 1.
response_formatOptionalurl or b64_json. Prefer url in most cases.

Gemini image example

For Gemini image models, you can pass aspect ratio and resolution via size / quality, or provide Google-native options through extra_fields:

curl -X POST "https://orbitaiapi.site/v1/images/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "Generate a 9:16 cyberpunk character poster",
"size": "9:16",
"quality": "2K",
"extra_fields": {
"google": {
"image_config": {
"aspect_ratio": "9:16",
"image_size": "2K"
}
},
"aspect_ratio": "9:16",
"image_size": "2K"
},
"response_format": "url"
}'

JavaScript example

import OpenAI from 'openai';

const client = new OpenAI({
apiKey: process.env.ORBIT_API_KEY,
baseURL: 'https://orbitaiapi.site/v1',
});

const result = await client.images.generate({
model: 'gpt-image-2',
prompt: 'A premium product poster with a clean background and realistic photography style',
size: '1024x1024',
quality: 'auto',
n: 1,
response_format: 'url',
});

console.log(result.data[0].url);

Image editing

Endpoint: POST /v1/images/edits

Use this endpoint to modify an existing image based on a prompt. Requests typically use multipart/form-data to upload the source image.

cURL example

curl -X POST "https://orbitaiapi.site/v1/images/edits" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "model=gpt-image-2" \
-F "image=@./input.png" \
-F "prompt=Change the background to light gray while keeping the main product, realistic photography style" \
-F "size=1024x1024" \
-F "n=1" \
-F "response_format=url"

Request fields

FieldRequiredDescription
modelRequiredImage model that supports editing. Use the exact name from the console.
imageRequiredSource image file. Common formats: PNG, JPG, WEBP.
promptRequiredEdit instruction describing how the image should change.
maskOptionalMask image. White areas are editable; black areas are preserved. Supported by some models.
sizeOptionalOutput size such as 1024x1024, depending on model support.
nOptionalNumber of images to generate. Usually 1.
response_formatOptionalurl or b64_json. Prefer url in most cases.
qualityOptionalOutput quality. Common values: auto, low, high. Support varies by model.

JavaScript example

import fs from 'fs';
import OpenAI from 'openai';

const client = new OpenAI({
apiKey: process.env.ORBIT_API_KEY,
baseURL: 'https://orbitaiapi.site/v1',
});

const result = await client.images.edit({
model: 'gpt-image-2',
image: fs.createReadStream('./input.png'),
prompt: 'Change the background to light gray while keeping the main product, realistic photography style',
size: '1024x1024',
n: 1,
response_format: 'url',
});

console.log(result.data[0].url);

Response example

A successful response usually looks like this:

{
"created": 1710000000,
"data": [
{
"url": "https://example.com/generated-image.png"
}
]
}

If you use response_format: "b64_json", the field is b64_json instead of url.

Best practices

  • Copy model names from the Model list or console. Avoid hardcoding names that may be retired.
  • For generation, write clear and specific prompts. For editing, state what to keep and what to change.
  • Prefer response_format: "url" for easier preview and download.
  • Call the API from your backend. Do not expose API keys in frontend code.
  • Supported sizes, quality options, and editing capabilities vary by model. Always verify against the console and actual responses.

Common issues

  • 401: Check that Authorization: Bearer YOUR_API_KEY is correct and the key is enabled.
  • 404: Confirm the Base URL includes /v1 and the path is /images/generations or /images/edits.
  • Model unavailable: Confirm account credit and use the exact model name shown in the console.
  • Edit failed: Check image format and size requirements, and make the edit prompt more specific.

For general integration details, see OpenAI-compatible API.