Embeddings
Send text to POST /v1/embeddings and you get one vector back for each input. The request and the response follow OpenAI’s Embeddings API, so the OpenAI SDKs work without changes.
curl https://api.indorouter.ai/v1/embeddings \ -H "Authorization: Bearer $INDOROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "openai/text-embedding-3-small", "input": ["hello", "selamat pagi"]}'import osfrom openai import OpenAI
client = OpenAI( base_url="https://api.indorouter.ai/v1", api_key=os.environ["INDOROUTER_API_KEY"],)
result = client.embeddings.create( model="openai/text-embedding-3-small", input=["hello", "selamat pagi"],)print(len(result.data[0].embedding))Request
Section titled “Request”| Field | Notes |
|---|---|
model |
Required. An embeddings model ID. |
input |
Required. A string, or a list of strings. None of them may be empty. Lists of token IDs are not accepted. |
dimensions, encoding_format |
Forwarded to the vendor unchanged. Support depends on the model. |
The body may be up to 10 MB. Each input has to fit the model’s per-input limit, which GET /v1/models lists as indorouter.embedding_input_tokens_max. An input over it is refused with input_too_large. Streaming is not available on this endpoint.
Response
Section titled “Response”The response uses the vendor’s format, with model set to the requested model ID and usage showing the token count used for billing. Vectors are in data[].embedding, in the same order as your inputs.
Models and billing
Section titled “Models and billing”Embeddings models are listed with GET /v1/models?output_modalities=embeddings, and on indorouter.ai/models. Only input tokens are charged, at the model’s prompt rate. Embeddings can also run as a batch.
See Error codes for errors and how to handle them.