GRGlobalRouter Docs
Console

Images / POST

Create image

Create an OpenRouter image generation request.

endpoint list

Mobile view shows the endpoint list. Use desktop view for parameters and examples.

MethodEndpointDescription
POST/api/v1/imagesCreate an OpenRouter image generation request.
POST/api/v1/images

For text-to-image or reference-image generation. For asynchronous tasks, cost is determined by OpenRouter usage.cost or generation metadata recorded at the terminal state.

Back to Images endpoint list

Request parameters

FieldTypeRequiredDescription
modelstringYesSee the OpenAPI schema for field details.
promptstringYesSee the OpenAPI schema for field details.
sizestringNoSee the OpenAPI schema for field details.
nintegerNoSee the OpenAPI schema for field details.
response_formatstringNoAllowed values: url, b64_json.
providerGrProviderConfigNoGR provider config object used by image/video task calls.
provider.provider_idstringNoSee the OpenAPI schema for field details.
provider.optionsobjectNoSee the OpenAPI schema for field details.

Response fields

FieldTypeRequiredDescription
createdintegerNoSee the OpenAPI schema for field details.
dataobject[]NoSee the OpenAPI schema for field details.
usageUsageNousage.cost is the upstream cost fact when present, including 0. GR billing may apply local discounts when writing final cost.
usage.prompt_tokensintegerNoSee the OpenAPI schema for field details.
usage.completion_tokensintegerNoSee the OpenAPI schema for field details.
usage.total_tokensintegerNoSee the OpenAPI schema for field details.
usage.costnumberNousage.cost
usage.is_byokbooleanNoSee the OpenAPI schema for field details.
usage.cost_detailsobjectNoSee the OpenAPI schema for field details.
usage.prompt_tokens_detailsobjectNoSee the OpenAPI schema for field details.
usage.completion_tokens_detailsobjectNoSee the OpenAPI schema for field details.
usage.server_tool_useobjectNoSee the OpenAPI schema for field details.

Errors

401UNAUTHORIZED

Missing or invalid Authorization Bearer token.

403FORBIDDEN

The current API key is not authorized for this scope, model, or management capability.

422VALIDATION_ERROR

The request body, path parameters, or query parameters do not match the endpoint schema.

Notes

  • Use a GlobalRouter API key; upstream OpenRouter API keys are never exposed to tenants.
  • An image endpoint provider object must exactly match the OpenRouter provider routing object; a GR provider wrapper is not automatically equivalent.
  • Upstream OpenRouter keys exist only in server-side configuration, never in requests or responses.