跳转到内容

中继 API: images

本页由 docs-site/openapi/relay.yaml 生成,内容为英文,请勿手工修改。

Image generation and editing (OpenAI shape).

Image generation

operationId relayImagesGenerations · auth: bearerAuth

Models priced per image report no usage; the gateway appends {"usage":{"cost":C}} so the cost stays visible.

Request body (required) application/json — ImageGenerationRequest

  • provider (RoutingPreferences) — Per-request routing wishes (OpenRouter-style). Use only the keys listed here: the Anthropic and Gemini dialects reject unknown keys with 400, and the others may ignore them. See docs/routing for the exact ranking.
    • order (array of string) — Provider tags to try first, in this order. Matching is case-insensitive.
    • only (array of string) — Use only these providers. 400 provider_not_found when none of them offers the model.
    • ignore (array of string) — Never use these providers.
    • sort (“price” | “latency” | “throughput”) — Rank the providers that are not named in order. Providers with no measurement yet rank last.
    • allow_fallbacks (boolean) — false together with order (or a model:provider pin) restricts routing to those providers. Without order or a pin it has no effect.
  • models (array of string) — Fallback list. The first entry that differs from model is tried after every provider of model has failed before the response started. One fallback model is used; further entries are ignored. The fallback is billed at its own price.
  • usage (UsageSwitch) — Accepted and removed before the request reaches the provider. The cost is always returned; the switch exists so that clients written for other gateways keep working.
    • include (boolean)
  • model (string, required)
  • prompt (string, required)
  • n (integer)
  • size (string)
  • quality (string)
Status Meaning Body
200 The images. application/json OpenAIObject
default Error in the OpenAI envelope (error.message, error.type, error.param, error.code). application/json OpenAIError

Response 200 application/json — OpenAIObject

The provider-shaped response object of the dialect, with cost added inside its usage object.

Image edit (multipart)

operationId relayImagesEdits · auth: bearerAuth

Body limit is GATEWAY_MAX_MULTIPART_BYTES (default 100 MiB).

Request body (required) multipart/form-data — MultipartForm

Form fields of the OpenAI endpoint (file, model, …), plus the optional gateway fields provider and models as JSON strings.

Status Meaning Body
200 The edited images. application/json OpenAIObject
default Error in the OpenAI envelope (error.message, error.type, error.param, error.code). application/json OpenAIError

Response 200 application/json — OpenAIObject

The provider-shaped response object of the dialect, with cost added inside its usage object.