Skip to content

Relay API: embeddings

This page is generated from docs-site/openapi/relay.yaml. Do not edit it by hand.

Vector embeddings (OpenAI shape and Gemini shape).

Gemini embedContent

operationId relayEmbedContent · auth: googApiKeyHeader or googApiKeyQuery or bearerAuth

Parameter In Type Required Description
model path string yes The model, directly followed by the :method of the route. The gateway splits at the last colon, so gpt-4o-mini:azure:generateContent calls gpt-4o-mini pinned to the provider tagged azure.

Request body (required) application/json — GeminiExtensions

  • 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)
Status Meaning Body
200 An embedding object with usageMetadata.cost added. application/json OpenAIObject
default Error in the Google envelope (error.code, error.message, error.status). application/json GeminiError

Response 200 application/json — OpenAIObject

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

POST /v1beta/models/{model}:batchEmbedContents

Section titled “POST /v1beta/models/{model}:batchEmbedContents”

Gemini batchEmbedContents

operationId relayBatchEmbedContents · auth: googApiKeyHeader or googApiKeyQuery or bearerAuth

Parameter In Type Required Description
model path string yes The model, directly followed by the :method of the route. The gateway splits at the last colon, so gpt-4o-mini:azure:generateContent calls gpt-4o-mini pinned to the provider tagged azure.

Request body (required) application/json — GeminiExtensions

  • 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)
Status Meaning Body
200 An embeddings array with usageMetadata.cost added. application/json OpenAIObject
default Error in the Google envelope (error.code, error.message, error.status). application/json GeminiError

Response 200 application/json — OpenAIObject

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

OpenAI embeddings

operationId relayEmbeddings · auth: bearerAuth

Request body (required) application/json — EmbeddingsRequest

  • 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)
  • input (any, required) — A string, or an array of strings or token arrays.
  • dimensions (integer)
  • encoding_format (“float” | “base64”)
Status Meaning Body
200 An embeddings list; usage.cost is added. 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.