Ratel Docs
ReferenceHTTP API

Embeddings

OpenAI-compatible text embeddings with a project API key.

For SDK setup and credit, see Embeddings.

POST /v1/embeddings

Embeds one or more texts. The request and response follow the OpenAI embeddings API, so an OpenAI-compatible client works with only a base URL change.

  • Method and path: POST /v1/embeddings (alias /api/v1/embeddings)
  • Auth: bearer API key with embeddings

Request

Content-Type: application/json, up to 4 MB.

FieldTypeNotes
inputstring or string[]Required. Not empty. Up to 512 strings.
modelstringOptional. ratel-embed-v1, or omit it.
encoding_formatstringOptional. Only float.

An input longer than the model's window is cut to fit, not rejected.

curl -s https://cloud.ratel.sh/v1/embeddings \
  -H "Authorization: Bearer $RATEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ratel-embed-v1", "input": ["leave a note on the task", "close the ticket"]}'

Response

200, in the OpenAI shape:

{
  "data": [
    { "index": 0, "embedding": [0.0213, -0.0472, 0.0118] },
    { "index": 1, "embedding": [-0.0094, 0.0381, 0.0257] }
  ],
  "model": "ratel-embed-v1",
  "usage": { "prompt_tokens": 12, "total_tokens": 12 }
}

Vectors are shortened here. When inputs were cut, the body adds truncated_inputs: the indexes of those inputs.

Each call spends Embeddings credit, by the tokens read.

Errors

The OpenAI envelope: { "error": { "message", "type" } }.

StatustypeCause
400invalid_request_errorBad JSON, empty or non-string input, more than 512 inputs, an unsupported model or encoding_format, or the provider rejected the input.
401invalid_request_errorMissing, invalid, revoked or expired key.
402insufficient_quotaOut of Embeddings credit, or the key's workspace no longer exists.
403permission_errorThe key does not have embeddings.
413invalid_request_errorBody over 4 MB.
429rate_limit_errorThe upstream provider is rate limiting. Retry with backoff. No Retry-After.
502api_errorThe upstream provider failed or timed out after 30 seconds. Retry.
503api_errorEmbeddings are not configured on this server.

On this page