Embeddings

POST /v1/embeddings is OpenAI's embeddings endpoint. The model is <provider>/<model>, for example openai/text-embedding-3-small, cohere/embed-v4.0 or openrouter/voyageai/voyage-4.

ProviderModels
openaitext-embedding-3-small, text-embedding-3-large, text-embedding-ada-002
cohereembed-v4.0, embed-english-v3.0, embed-multilingual-v3.0. Text only, at most 96 inputs per request. input_type defaults to search_document.
openrouterOpenAI, Google Gemini, Voyage, Mistral, Qwen and open models. GET /v1/models lists them.
cURLcurl
1curl https://api.aile.sh/v1/embeddings \
2-H "Authorization: Bearer $AILE_KEY" \
3-H "Content-Type: application/json" \
4-d '{ "model": "openai/text-embedding-3-small", "input": ["first text", "second text"] }'

input is a string, an array of strings, or token arrays (not on Cohere). openrouter/voyageai/voyage-multimodal-3.5 and openrouter/google/gemini-embedding-2 also take OpenRouter's multimodal shape, input: [{ "content": [parts] }], with text, image_url and (Gemini) input_audio parts.

  • dimensions or Voyage's output_dimension sets the vector size where the model supports it.
  • encoding_format: "base64" is honoured on every provider.
  • On openrouter models only the documented embeddings fields are forwarded. OpenRouter routing fields are dropped.
  • usage carries token counts only. OpenRouter's cost fields are removed.

Billing

  • Billed per input token, at list price × the serving lender's margin. The cheapest lender is tried.
  • Image and audio input bill at their own published rates where the model has them.
  • The hold is an estimate. The charge is the token count the provider reports, up to the hold.
  • A $AILE discount tab applies, as on chat.
  • A key's pins and the routing headers choose the lender here too, and x-aile-provider must match the model's prefix. x-aile-max-price and a key's price limit are checked against each lender's price, at the dearest input tier the request carries.
  • A response with no vectors, a vector count that does not match the inputs, or no token count is a 502 and is not charged.
  • A provider refusal you can fix (400, 404, 413, 422 …) passes through. One about the lender's account is a 502 saying you were not charged. A 502 or 504 arrives as 503 with the real code in x-aile-status.
  • An API key is required. Keyless x402 does not cover embeddings.