Skip to content
exoticrouter.com ↗

Embeddings

Turn text into vectors, for search, clustering and retrieval. The format is OpenAI’s, and the request is passed to the model as you send it.

POST https://api.exoticrouter.com/v1/embeddings

cURL
curl https://api.exoticrouter.com/v1/embeddings \
-H "Authorization: Bearer $EXOTIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/text-embedding-3-small",
"input": ["The sky is blue.", "Glass is a liquid, some say."]
}'
Python
result = client.embeddings.create(
model="openai/text-embedding-3-small",
input=["The sky is blue.", "Glass is a liquid, some say."],
)
print(len(result.data), "vectors of", len(result.data[0].embedding), "numbers")
TypeScript
const result = await client.embeddings.create({
model: "openai/text-embedding-3-small",
input: ["The sky is blue.", "Glass is a liquid, some say."],
});
console.log(result.data.length, "vectors of", result.data[0].embedding.length, "numbers");
  • model has to be an embeddings model: one whose formats in the list of models has embeddings. A chat model does not answer here.
  • The rest of the body goes to the model untouched, dimensions and encoding_format included.
{
"object": "list",
"model": "openai/text-embedding-3-small",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789] },
{ "object": "embedding", "index": 1, "embedding": [-0.0312, 0.0654, 0.0098] }
],
"usage": { "prompt_tokens": 14, "total_tokens": 14 }
}

One vector for each input, in the order sent (the vectors above are cut short). model is the model’s full id.

An embeddings request is charged on its input tokens at the model’s input_per_mtok, plus the model’s per_request if it has one. There is no output to pay for. See Billing.

  • Models and ids: Find the embeddings models in the list.
  • Errors: What each status means and what to do about it.