/v1/images/generationsGenerate images
OpenAI-compatible image generation. Buffered only: stream and partial_images are refused. Some models always return b64_json even when url is asked for, and GPT image models refuse response_format: url.
usage is the provider's own object when it reports one. Image responses carry no usage.cost.
認証: AuthorizationヘッダーにBearer形式のAPIキー
リクエストボディ
modelstring必須An image model slug.
promptstring必須What to draw.
nintegerNumber of images.
sizeenumOutput size. Which sizes a model accepts depends on the model.
qualityenumbackgroundenumoutput_formatenumoutput_compressionintegermoderationenumresponse_formatenumstyleenumuserstringEnd-user id for your own attribution. Not forwarded.
レスポンス
200The images.
レスポンス
createdintegerdataarray<object>data
b64_jsonstringurlstringrevised_promptstring
backgroundstringoutput_formatstringqualitystringsizestringusageobjectThe provider's usage object, when it reports one.
400Invalid request. param names the field; code says why (invalid_parameter, unsupported_parameter, unsupported_capability, refusal, previous_response_not_found). Not charged.
レスポンス
errorobjecterror
messagestringWhat went wrong and how to fix it.
typestringFor example
invalid_request_error,authentication_error,permission_error,rate_limit_error,insufficient_quota,api_error.codestringThe stable error code.
paramstring | nullThe request field at fault, when there is one.
refusal_reasonenumPresent only on
code: refusal.
401The key is missing, malformed, expired or revoked.
レスポンス
errorobjecterror
messagestringWhat went wrong and how to fix it.
typestringFor example
invalid_request_error,authentication_error,permission_error,rate_limit_error,insufficient_quota,api_error.codestringThe stable error code.
paramstring | nullThe request field at fault, when there is one.
refusal_reasonenumPresent only on
code: refusal.
402The organization must act first: card_required, email_unverified, org_under_review, free_tier_requires_payment or promotion_ended. The message names the step; retrying does not help.
レスポンス
errorobjecterror
messagestringWhat went wrong and how to fix it.
typestringFor example
invalid_request_error,authentication_error,permission_error,rate_limit_error,insufficient_quota,api_error.codestringThe stable error code.
paramstring | nullThe request field at fault, when there is one.
refusal_reasonenumPresent only on
code: refusal.
403model_not_granted (use an id from GET /v1/models), model_location_not_supported, or a zero-data-retention demand no route can meet.
レスポンス
errorobjecterror
messagestringWhat went wrong and how to fix it.
typestringFor example
invalid_request_error,authentication_error,permission_error,rate_limit_error,insufficient_quota,api_error.codestringThe stable error code.
paramstring | nullThe request field at fault, when there is one.
refusal_reasonenumPresent only on
code: refusal.
429insufficient_quota (out of credits, over a spend limit, or the model needs a purchase) and promo_credits_now (a free promotion is used up): add credits, the message names the step. rate_limit_exceeded, free_limit_reached, admission_capacity_exceeded: wait Retry-After seconds and retry.
レスポンス
errorobjecterror
messagestringWhat went wrong and how to fix it.
typestringFor example
invalid_request_error,authentication_error,permission_error,rate_limit_error,insufficient_quota,api_error.codestringThe stable error code.
paramstring | nullThe request field at fault, when there is one.
refusal_reasonenumPresent only on
code: refusal.
503gateway_unavailable, gateway_draining, unavailable_route or deadline_exceeded. Retry with backoff, honoring Retry-After when present.
レスポンス
errorobjecterror
messagestringWhat went wrong and how to fix it.
typestringFor example
invalid_request_error,authentication_error,permission_error,rate_limit_error,insufficient_quota,api_error.codestringThe stable error code.
paramstring | nullThe request field at fault, when there is one.
refusal_reasonenumPresent only on
code: refusal.
リクエスト
curl https://api.experientiallabs.ai/v1/images/generations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-1", "prompt": "A lighthouse at dusk, watercolor", "size": "1024x1024"}'
レスポンス
{
"created": 1795132800,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"size": "1024x1024",
"quality": "medium",
"output_format": "png",
"usage": {
"input_tokens": 12,
"output_tokens": 1056,
"total_tokens": 1068
}
}https://api.experientiallabs.ai/v1/images/generations