Tài liệu
Tương thích OpenAI
Use the OpenAI client library
Image generation works with the OpenAI libraries when you change the base URL and the key:
from openai import OpenAI
client = OpenAI(base_url="https://api.cheapvids.com/v1", api_key="cv_live_YOUR_KEY")
image = client.images.generate(model="gpt-image-2.5", prompt="A lighthouse at dusk", size="1024x1024")
print(image.data[0].url)
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.cheapvids.com/v1", apiKey: "cv_live_YOUR_KEY" });
const image = await client.images.generate({ model: "gpt-image-2.5", prompt: "A lighthouse at dusk", size: "1024x1024" });
console.log(image.data[0].url);
What is supported
Only POST /v1/images/generations. There is no images/edits or images/variations, and no chat, text or video endpoint on the compatible surface (use POST /v1/generations for video).
| Field | Behavior |
|---|---|
model | Required. An image model id from GET /v1/models. A video model returns 422. |
prompt | Required. |
n | Must be 1 or omitted; any other value returns 422 ("n must be 1; send separate requests"). |
size | 1024x1024, 1536x1024, 1792x1024, 1024x1536, 1024x1792 or auto. Mapped to the closest aspect ratio the model supports: square becomes 1:1, wide 16:9, tall 9:16; auto uses the model default. |
quality | hd selects 2k resolution when the model supports it; other values are ignored. |
response_format | url (default) or b64_json. |
user | Ignored. |
plan | CheapVids extension, see below. Unknown fields are ignored. |
The plan
plan is optional here. Without it the request uses credits. You can send plan in the body or in the X-Plan header (when both are present they must agree, otherwise 422). The only value accepted is credits; studio (a plan that was retired on 2026-11-19) and any other value return 422 invalid_parameters.
With the OpenAI libraries you can pass it through extra_body={"plan": "credits"} (Python) or extra_headers (X-Plan).
Response
The request waits for the image, up to 90 seconds. On success:
{ "created": 1760000000, "data": [{ "url": "https://api.cheapvids.com/v1/generations/0190.../content?exp=...&sig=..." }] }
urlis a CheapVids URL (valid one hour, and the result stays downloadable for the download window, see Generations). Withresponse_format: "b64_json"the image is returned asb64_json(up to 20 MiB; larger images or a source error fall back tourl).- If the image is not ready after 90 seconds the answer is
504with codegeneration_pendinganddetails.generation_id. The job keeps running: read it withGET /v1/generations/{id}. - A failed job returns the error of the job (for example
content_policy_violation) and is refunded.
Retries do not double charge
OpenAI libraries retry on 5xx and timeouts with the same body. Because an identical request within 120 seconds returns the original job (Idempotency), a retry after 504 finds the same job and charges nothing more. For the SDKs and other calls use the native endpoints.

