Embeddings
POST /v1/embeddings
compatible
semantic operation embed
contract revision 1
State semantics: stateless; an Idempotency-Key adds a 24 hour record of the key, its request fingerprint and how far the request got, and no part of the request or the answer
Raw contract deviations
These statements are source-contract evidence. Use the examples, field table, and Profile coverage matrix for ordinary integration, and expand this list when investigating a compatibility boundary.
- gateway routes model names
- unknown request fields are rejected before provider I/O
- provider-specific unsupported fields are rejected before provider I/O
- Idempotency-Key is optional and buys at-most-once execution upstream, not response replay: a repeat of a key whose request finished answers 409 idempotency_completed rather than the original answer, because the answer is not stored
- a repeat while the first request is still running answers 409 idempotency_in_progress; it is a refusal rather than a wait, because holding a socket against another request’s outcome is not something this gateway does
- a repeat after a request that may have reached the provider and whose outcome nobody can determine — an ambiguous upstream failure, or a dispatch interrupted by a restart — answers 409 idempotency_outcome_unknown, which retrying the same key will not change; whether to give up or retry under a new key is the caller’s decision
- the same key with a different request body answers 409 idempotency_conflict, and keys are scoped to one Project so two Projects may use the same external key
- a request with no Idempotency-Key behaves exactly as before and writes nothing durable; the key is what buys the record
- a request the gateway refuses on its own — a capability filter, a token limit, a Project budget — never reached the upstream and gives its key back, so a retry is answered by the limit it broke rather than by a conflict about a call nobody made
- a key is remembered for 24 hours, whatever state its request ended in, after which the same key is free again — including for a different request
Request examples
Section titled “Request examples”curl https://halro.example.com/v1/embeddings \ -H "Authorization: Bearer $HALRO_GATEWAY_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "embed", "input": ["first passage", "second passage"] }'import osfrom openai import OpenAI
client = OpenAI(base_url="https://halro.example.com/v1", api_key=os.environ["HALRO_GATEWAY_KEY"], timeout=60.0, max_retries=0)response = client.embeddings.create(model="embed", input=["first passage", "second passage"])print(len(response.data), "vectors, dimension", len(response.data[0].embedding))import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://halro.example.com/v1", apiKey: process.env.HALRO_GATEWAY_KEY, timeout: 60_000, maxRetries: 0,});const response = await client.embeddings.create({ model: "embed", input: ["first passage", "second passage"],});console.log(response.data.length, "vectors, dimension", response.data[0].embedding.length);Request headers
Section titled “Request headers”AuthorizationContent-TypeIdempotency-Key
Request fields
Section titled “Request fields”| Field | Provider Profiles that do not support it | Combination-level constraints |
|---|---|---|
model | — | — |
input | bedrock.runtime.invoke.titan-embed-text-v2.v1 | — |
encoding_format | bigmodel.cn.chat-embeddings.v1, gemini.generate-content.text.v1beta, bedrock.runtime.invoke.titan-embed-text-v2.v1 | 1 |
dimensions | bedrock.runtime.invoke.titan-embed-text-v2.v1 | — |
user | bigmodel.cn.chat-embeddings.v1, gemini.generate-content.text.v1beta, bedrock.runtime.invoke.titan-embed-text-v2.v1 | 2 |
Response fields
Section titled “Response fields”object data model usage
Provider Profile contract coverage and current availability
Section titled “Provider Profile contract coverage and current availability”| Provider Profile | Maturity | Current build | Unsupported request fields |
|---|---|---|---|
openai.chat-embeddings.v1 | compatible | creatable | undeclared |
azure-openai.chat-embeddings.v1 | compatible | creatable | undeclared |
bigmodel.cn.chat-embeddings.v1 | experimental | creatable | encoding_format, user |
openai-compatible.chat-embeddings.v1 | compatible | creatable | undeclared |
gemini.generate-content.text.v1beta | compatible | creatable | encoding_format, user |
bedrock.runtime.invoke.titan-embed-text-v2.v1 | experimental | withheld (cannot create) | input, encoding_format, dimensions, user |
Declared transformations
Section titled “Declared transformations”bigmodel.cn.chat-embeddings.v1
- the OpenAI-shaped embedding body is sent to the mainland /api/paas/v4/embeddings route
- encoding_format and user are omitted only when absent and otherwise rejected before provider I/O
gemini.generate-content.text.v1beta
- token usage is locally estimated when Gemini omits usage
bedrock.runtime.invoke.titan-embed-text-v2.v1
- only one string input is accepted
- dimensions are limited to 256, 512, or 1024
- native requests force normalized float embeddings
- Bedrock inputTextTokenCount is mapped to OpenAI usage
Evidence
Section titled “Evidence”Verified evidence: gateway_contract, provider_transport_fixture, sdk_blackbox
SDK black-box protocol-stub matrix
Section titled “SDK black-box protocol-stub matrix”openai-go, openai-node, openai-python
Best practices
Section titled “Best practices”See Embedding index and Rerank planning.
Fields, coverage, transformations, and deviations are generated from Halro 9649ecb8e200
(scripts/generate-api-pages-en.mjs; synchronized manifest digest 5d90dc530c8428bd…).
The contract currently carries field names, not complete types, required relationships, or value semantics.
Footnotes
Section titled “Footnotes”-
Combination constraints for
encoding_format:bigmodel.cn.chat-embeddings.v1: encoding_format and user are omitted only when absent and otherwise rejected before provider I/O
-
Combination constraints for
user:bigmodel.cn.chat-embeddings.v1: encoding_format and user are omitted only when absent and otherwise rejected before provider I/O