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
A request
Section titled “A request”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."] }'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")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");modelhas to be an embeddings model: one whoseformatsin the list of models hasembeddings. A chat model does not answer here.- The rest of the body goes to the model untouched,
dimensionsandencoding_formatincluded.
The answer
Section titled “The answer”{ "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.
What it costs
Section titled “What it costs”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.
Where next
Section titled “Where next”- Models and ids: Find the embeddings models in the list.
- Errors: What each status means and what to do about it.