Image Generation and Editing
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
| Parameter | Value |
|---|---|
| Base URL | https://orbitaiapi.site/v1 |
| Authentication | Authorization: Bearer YOUR_API_KEY |
| Model | Exact 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
| Field | Required | Description |
|---|---|---|
model | Required | Image model name, such as gpt-image-2, gpt-image-2-all, or a Gemini image model. |
prompt | Required | Description of the image to generate. |
size | Optional | Common GPT sizes: 1024x1024, 1536x1024, 1024x1536. Gemini images may accept aspect ratios or model-specific sizes. |
quality | Optional | Common values: auto, low, high, 2K, 4K. Support varies by model. |
n | Optional | Number of images to generate. Usually 1. |
response_format | Optional | url 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
| Field | Required | Description |
|---|---|---|
model | Required | Image model that supports editing. Use the exact name from the console. |
image | Required | Source image file. Common formats: PNG, JPG, WEBP. |
prompt | Required | Edit instruction describing how the image should change. |
mask | Optional | Mask image. White areas are editable; black areas are preserved. Supported by some models. |
size | Optional | Output size such as 1024x1024, depending on model support. |
n | Optional | Number of images to generate. Usually 1. |
response_format | Optional | url or b64_json. Prefer url in most cases. |
quality | Optional | Output 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 thatAuthorization: Bearer YOUR_API_KEYis correct and the key is enabled.404: Confirm the Base URL includes/v1and the path is/images/generationsor/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.