Cohere Embed 5 and Rerank 5
Cohere's search models are called through two LLMTR endpoints. The Embed 5 models turn text, images and inputs that combine both into vectors on /v1/embeddings. The Rerank 5 models order candidate documents against a query on /v1/rerank and, on request, return the most relevant passages inside each document. Both work with your existing LLMTR API key.
| Model | Endpoint | Context | Inputs | Price ($/1M tokens) |
|---|---|---|---|---|
cohere/embed-v5.0-pro |
/v1/embeddings |
128,000 | Text, images, both together | 0.12 |
cohere/embed-v5.0-fast |
/v1/embeddings |
128,000 | Text, images, both together | 0.08 |
cohere/rerank-v5.0-pro |
/v1/rerank |
32,768 | Text | 0.05 |
cohere/rerank-v5.0-fast |
/v1/rerank |
32,768 | Text | 0.02 |
Prices
Section titled “Prices”Prices are US dollars per 1 million tokens and equal Cohere's list prices. The Embed 5 price in the table is for text tokens. Images are counted as tokens too and billed at $0.40 per 1M image tokens on both models; an image's token count grows with its resolution. The response's usage.prompt_tokens carries the sum of text and image tokens.
On the Rerank 5 models the billed tokens are query tokens x number of documents plus the tokens of all documents. The response's usage.total_tokens carries that number.
No platform margin is added to model prices; the margin applies only when you top up credit. See Billing for details.
Embed 5: first request
Section titled “Embed 5: first request”curl "$LLMTR_BASE_URL/v1/embeddings" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "cohere/embed-v5.0-pro", "input": ["The notice period for terminating the lease is thirty days."], "input_type": "document" }'The response is OpenAI-shaped; the OpenAI SDK works with a changed base_url:
from openai import OpenAI
client = OpenAI(base_url="https://llmtr.com/v1", api_key="llmtr-your_key")
docs = client.embeddings.create( model="cohere/embed-v5.0-pro", input=["The notice period for terminating the lease is thirty days."], extra_body={"input_type": "document"},)print(len(docs.data[0].embedding)) # 2048input_type
Section titled “input_type”Queries and documents are embedded differently. For search, send documents with document and queries with query; sending both with the same type lowers accuracy.
input_type |
When |
|---|---|
document or search_document |
Documents and chunks you add to the index. Used when the field is omitted. |
query or search_query |
The user's search query. |
classification |
Texts that will feed a classifier. |
clustering |
Texts to be clustered. |
Any other value returns 400 invalid_request.
cohere/embed-v5.0-pro and cohere/embed-v5.0-fast share one vector space. You can index a collection with Pro and send queries with Fast; the vectors are comparable as long as you use the same dimensions value.
Images and mixed input
Section titled “Images and mixed input”Images are sent as base64 data URIs (data:image/png;base64,...). PNG, JPEG, WebP and GIF are accepted. An image URL is not accepted and returns 400 invalid_request; read the image on your side and encode it as base64.
input can take two forms:
- A list of
{ "content": [...] }objects: each object produces its own vector. - A single list of content parts (
[{ "type": "text", ... }, { "type": "image_url", ... }]): all parts together produce one vector. Use this form to embed the text and the image of a PDF page together.
import base64from openai import OpenAI
client = OpenAI(base_url="https://llmtr.com/v1", api_key="llmtr-your_key")
with open("product.png", "rb") as f: image = "data:image/png;base64," + base64.b64encode(f.read()).decode()
# Two vectors: one for the image alone, one for the text alone.separate = client.embeddings.create( model="cohere/embed-v5.0-fast", input=[ {"content": [{"type": "image_url", "image_url": {"url": image}}]}, {"content": [{"type": "text", "text": "White t-shirt and blue jeans"}]}, ], extra_body={"input_type": "document"},)
# One vector: text and image together.fused = client.embeddings.create( model="cohere/embed-v5.0-fast", input=[ {"type": "text", "text": "Product card: white t-shirt, blue jeans"}, {"type": "image_url", "image_url": {"url": image}}, ], extra_body={"input_type": "document"},)Index images with document, and use query for the text you search them with.
Output size and type
Section titled “Output size and type”| Field | Description |
|---|---|
dimensions |
256, 512, 768, 1024, 1536 or 2048. 2048 when omitted. Any other value returns 400 invalid_request listing the accepted values. The output_dimension spelling is accepted too. |
output_dtype |
float (default), int8, uint8, binary or ubinary. binary and ubinary pack the vector into bits; the length is one eighth of the dimension. Cohere's single-value embedding_types array is accepted too. |
encoding_format |
float (default) or base64. base64 applies only to the float type and returns the float32 bytes of the vector; with the other types the vector comes back as a list of integers. The OpenAI SDKs send base64 on their own and read both forms. |
truncation |
true (default) shortens a long input from the end. With false, an input over 128,000 tokens is rejected with 400. |
Embed 5 limits
Section titled “Embed 5 limits”- At most 96 inputs per request. More returns
400 invalid_request; split the list into batches of 96. - At most 128,000 tokens per input.
- Nested arrays (
[["chunk 1", "chunk 2"]]) are not accepted.
Rerank 5: request
Section titled “Rerank 5: request”curl "$LLMTR_BASE_URL/v1/rerank" \ -H "Authorization: Bearer llmtr-your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "cohere/rerank-v5.0-pro", "query": "How many days do I have to return a defective product?", "documents": [ "Products can be returned within 14 days of delivery.", "Our stores are open on weekdays from 10:00 to 22:00.", "Defective products can be returned within 30 days and we cover the shipping cost." ], "top_n": 2, "relevant_spans": { "mode": "enabled", "max_spans": 2 } }'| Field | Required | Description |
|---|---|---|
query |
Yes | The query the documents are scored against. |
documents |
Yes | Candidate documents, at most 1000 items. Write records such as tables or JSON as YAML text. |
top_n |
No | Returns only the N highest-scoring results. The top_k spelling is accepted too. |
return_documents |
No | When true, each result also carries its document text. |
max_tokens_per_doc |
No | The most tokens read from one document. When omitted a document is read up to the model's context; anything longer is shortened. |
relevant_spans |
No | Context Focus. mode is required (enabled or disabled). threshold is between 0 and 1, default 0.1; only passages scoring above it are returned. max_spans is the most passages per document; -1 returns all of them. |
Rerank 5 shortens a long document instead of rejecting it. truncation: false is therefore not accepted and returns 400 invalid_request; set the limit with max_tokens_per_doc.
relevant_spans and max_tokens_per_doc are valid on these two models only. Sent to another rerank model, the request is rejected with 400 invalid_request.
Context Focus response
Section titled “Context Focus response”{ "object": "list", "data": [ { "index": 2, "relevance_score": 0.3949, "relevant_spans": [{ "start": 0, "end": 79, "score": 0.9950 }] }, { "index": 0, "relevance_score": 0.3448, "relevant_spans": [{ "start": 0, "end": 65, "score": 0.9935 }] } ], "model": "cohere/rerank-v5.0-pro", "usage": { "total_tokens": 132 }}start and end are the start and end of the passage inside the document, counted in Unicode code points; end is exclusive. In Python documents[i][start:end] works directly. JavaScript strings are UTF-16, so split the text into code points with Array.from(text) first:
const chars = Array.from(documents[item.index]);const passage = chars.slice(span.start, span.end).join("");Sending these passages to the language model instead of whole documents keeps the context and the token spend smaller.
Scores and thresholds
Section titled “Scores and thresholds”relevance_score is between 0 and 1. Rerank 5 scores are calibrated across queries and domains: one threshold can drop low-scoring results across different queries. Pick the threshold with a few sample queries on your own data.
Choosing a model
Section titled “Choosing a model”cohere/embed-v5.0-pro: highest accuracy; for indexing a collection and for searches where accuracy decides.cohere/embed-v5.0-fast: lower latency and price; for the query side, agent loops and high-volume search.cohere/rerank-v5.0-pro: complex queries and long or domain-specific documents.cohere/rerank-v5.0-fast: high-volume endpoints that rerank every query.
Errors
Section titled “Errors”| Status | Meaning |
|---|---|
400 invalid_request |
Invalid field: more than 96 inputs, an image URL, an unsupported dimensions, input_type or output_dtype, rerank with truncation: false, an out-of-range relevant_spans value. The message names the field. |
404 model_not_found |
The model ID is not in the catalog. |
429 rate_limit_error |
The API key's request limit was exceeded. |
502 provider_error |
The provider could not complete the request. Try again later. |
503 model_unavailable |
The model is temporarily unavailable. Try again later. |
For the general request shapes see Embeddings and Rerank.