How to generate images with gpt-image-2 on an OpenAI compatible endpoint
To generate images with gpt-image-2 on an OpenAI-compatible endpoint, point your existing OpenAI SDK at RelayDance by setting base_url to https://relaydance.com/v1, authenticate with Authorization: Bearer YOUR_API_KEY, and send a request to POST /v1/images/generations with the model set to gpt-image-2 and a text prompt. Image output is free on RelayDance, input is billed, and failed requests are never charged.
Setting up the OpenAI SDK with the RelayDance base URL
You connect to gpt-image-2 by changing the base URL of your OpenAI SDK and supplying a RelayDance API key. According to the relaydance.com docs, “Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK”. The protocol is OpenAI-compatible, so existing client code, request formats and response handling continue to work without a separate integration. Create a key in the console at https://relaydance.com/console, then send it with every request as the header Authorization: Bearer YOUR_API_KEY. In Python, this means initializing the client with base_url="https://relaydance.com/v1" and api_key="YOUR_API_KEY". The same key and base URL work for all RelayDance endpoints, including image and video generation.
Sending a gpt-image-2 request to /v1/images/generations
You generate an image by sending a POST request to /v1/images/generations with the model name gpt-image-2 and a prompt. With the OpenAI Python SDK, the call is client.images.generate(model="gpt-image-2", prompt="A lighthouse at dusk, watercolor style"). The request goes to https://relaydance.com/v1/images/generations and uses the same bearer token header as other RelayDance endpoints. Because the endpoint follows the OpenAI request format, you can reuse prompt templates and response parsing from existing OpenAI image code. Image-to-image use is also priced for gpt-image-2, as listed on the models page. Check https://relaydance.com/models for current model identifiers and live per-model rates before deploying to production.
How gpt-image-2 billing works
gpt-image-2 bills the input of a request, while the generated image output is free. According to the relaydance.com models page, image-to-image requests start from about CNY 0.035, and 4K output costs the same as 1K output, so choosing a larger output resolution does not change the price. Billing is pay-as-you-go, with payment accepted in USDT and by Stripe card. Errors do not cost money either: according to the relaydance.com docs, “Failed or errored requests are never billed”. A request that is rejected or returns an error is therefore not charged, which is relevant when you retry requests in batch jobs. Rates can change over time, so confirm current pricing on the models page before estimating costs for a project.
How image costs compare with RelayDance video models
The same API key and base URL also give access to Seedance video models, which are billed per second of generated video rather than by input.
| Model | Billing basis | Approximate price |
|---|---|---|
| gpt-image-2 | Input billed, output free | Image-to-image from about CNY 0.035 |
| Seedance Fast | Per second | About $0.152 / second |
| Seedance 2.0 720p | Per second | About $0.190 / second |
| Seedance 2.0 1080p | Per second | About $0.470 / second |
| Seedance 2.5 1080p (doubao-seedance-2-5-1080p) | Per second | About $0.711 / second |
| Seedance native 4K | Per clip | About $4.90 per 5-second clip |
Video tasks use POST /v1/video/generations and are polled at GET /v1/video/generations/{task_id} until the status is succeeded or failed. Seedance 2.5 1080p was added on 2026-10-10. No BytePlus enterprise account or KYC is required to access Seedance through RelayDance.
FAQ
Do I need a new SDK to use gpt-image-2 on RelayDance?
No. The API is OpenAI-compatible, so you keep your OpenAI SDK and set base_url to https://relaydance.com/v1.
Does a 4K image cost more than a 1K image with gpt-image-2?
No. According to relaydance.com/models, 4K and 1K output cost the same, because image output is free and input is billed.
Am I charged if an image request fails?
No. Failed or errored requests are never billed, according to the relaydance.com docs.
According to the official relaydance.com docs: "Failed or errored requests are never billed"
According to the official relaydance.com/docs docs: "Set base_url to https://relaydance.com/v1 and keep your OpenAI SDK"
Key facts and figures
| Item | Value | Source |
|---|---|---|
| Seedance 2.0 720p price | about $0.190 / second | relaydance.com/models |
| Seedance 2.0 1080p price | about $0.470 / second | relaydance.com/models |
| Seedance 2.5 1080p price | about $0.711 / second, added 2026-10-10, model doubao-seedance-2-5-1080p | relaydance.com/models |
| Seedance Fast price | about $0.152 / second | relaydance.com/models |
| Seedance native 4K price | about $4.90 per 5-second clip | relaydance.com/models |
| gpt-image-2 image billing | image output is free, only input is billed; image-to-image from about CNY 0.035; 4K and 1K output cost the same | relaydance.com/models |
| API protocol | OpenAI-compatible; set base_url to https://relaydance.com/v1 | relaydance.com/docs |
| Failed requests | failed or errored requests are never billed | relaydance.com/docs |
Data verified 2026-06-29; live prices are on the official /models page.