Embed API (Cohere Compatible)¶
Generate vector embeddings for semantic search and RAG applications with Amazon Bedrock embedding models through a Cohere-compatible interface.
This is an alternate route to the OpenAI-compatible Embeddings API: both are served by the same embedding backends and models, so anything supported there is supported here.
Route Prefix & Base URL
By default, all Cohere-compatible routes are prefixed with /cohere. This means the Embed API is available at /cohere/v2/embed instead of /v2/embed. You can customize this prefix using the COHERE_ROUTES_PREFIX configuration variable documented in Operations Configuration.
The curl examples below use a $BASE variable that must include this prefix — set it to your scheme and host followed by COHERE_ROUTES_PREFIX:
export BASE="https://your-host/cohere" # <scheme>://<host> + COHERE_ROUTES_PREFIX
Why Choose Embed?¶
-
Semantic Search
Turn texts and images into dense vectors for similarity search that understands meaning, not just keywords. -
Higher RAG Quality
Build retrieval pipelines on high-quality embeddings, withinput_typetuning for queries versus documents. -
Drop-in Cohere Compatibility
Follows the Cohere v2 Embed API shape. Existing Cohere embed integrations work by changing the base URL. -
Private AWS Backend
Served entirely by Bedrock embedding models in your own AWS account — no traffic to third-party endpoints.
Quick Start: Available Endpoints¶
| Endpoint | Method | What It Does | Powered By | MCP Tool |
|---|---|---|---|---|
/v2/embed |
POST |
Transform texts and images into semantic float vectors | Bedrock embedding models | cohere_embed |
/v1/embed |
POST |
Legacy v1 embed for older SDKs and integrations | Bedrock embedding models | cohere_embed_v1 |
Example request:
curl -X POST "$BASE/v2/embed" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cohere.embed-multilingual-v3",
"input_type": "search_document",
"texts": ["Hello world", "Bonjour le monde"]
}'
Example response:
{
"response_type": "embeddings_by_type",
"id": "0f1b3c6e8d9a4b5c8e7f6a5b4c3d2e1f",
"embeddings": {"float": [[0.012, -0.034, ...], [0.041, 0.007, ...]]},
"texts": ["Hello world", "Bonjour le monde"],
"meta": {
"api_version": {"version": "2"},
"billed_units": {"input_tokens": 8}
}
}
Find compatible models: Call /search_models with route=cohere_embed to discover model IDs that support embeddings — every Bedrock embedding model works, not just Cohere ones.
Feature Compatibility¶
| Feature | Status | Notes |
|---|---|---|
| Input | ||
texts |
Full support | |
images |
Multimodal models only; data URIs, plus URLs and S3 URIs | |
inputs (fused text + image) |
Rejected with 400 — use texts or images instead |
|
| Model Parameters | ||
input_type |
Applied to Cohere models; no equivalent on other providers | |
output_dimension |
Some models support dimension reduction | |
truncate, max_tokens |
Cohere models only | |
embedding_types |
int8/uint8/binary/ubinary on Cohere models, binary also on Titan Embed v2; base64 always computed client-side; other combinations return 400 |
|
priority |
Accepted but ignored — request scheduling priority is not applicable on Bedrock | |
| Extra model-specific params | Extra fields are forwarded as additional model request parameters | |
| Output | ||
images metadata array |
Echoed by models that report image dimensions (e.g. Cohere Embed) | |
| Usage tracking | ||
billed_units.input_tokens |
Estimated on some models |
Legend:
- Supported — Fully compatible with the Cohere API
- Available on Select Models — Check your model's capabilities
- Partial — Supported with limitations
- Unsupported — Not available in this implementation
- Extra Feature — Enhanced capability beyond the Cohere API
Quantized and Base64 Embedding Types¶
Set embedding_types to request quantized vectors alongside, or instead of, the default float vectors. Bedrock Cohere Embed models natively support int8, uint8, binary, and ubinary; Titan Embed v2 natively supports binary. base64 is always available: it is computed client-side (little-endian float32 bytes, base64-encoded) from the float embedding, matching the Cohere API encoding. Requesting a type not supported by the resolved model returns 400. Only the requested types are populated in the response.
curl -X POST "$BASE/v2/embed" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cohere.embed-v4:0",
"input_type": "search_document",
"texts": ["Hello world"],
"embedding_types": ["int8", "base64"]
}'
{
"response_type": "embeddings_by_type",
"id": "0f1b3c6e8d9a4b5c8e7f6a5b4c3d2e1f",
"embeddings": {
"int8": [[12, -34, ...]],
"base64": ["rBgKPw..."]
},
"texts": ["Hello world"],
"meta": {
"api_version": {"version": "2"},
"billed_units": {"input_tokens": 4}
}
}
Cohere v1 Embed API (Legacy)¶
The legacy /v1/embed endpoint is also available for older Cohere SDKs (cohere.Client) and third-party integrations that predate the v2 API. It shares the same Bedrock backend and model support as /v2/embed; new clients should prefer the v2 endpoint.
Differences from the v2 endpoint:
| Feature | Status | Notes |
|---|---|---|
| Default response shape | Legacy embeddings_floats: a plain list of float vectors |
|
embedding_types |
Any value switches to the embeddings_by_type shape; same type support as the v2 endpoint |
|
input_type |
Optional — forwarded to Cohere models when provided; the backend defaults to search_document otherwise |
|
meta.api_version.version |
Reported as "1" |
Example request:
curl -X POST "$BASE/v1/embed" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "cohere.embed-multilingual-v3",
"input_type": "search_document",
"texts": ["Hello world", "Bonjour le monde"]
}'
Example response:
{
"response_type": "embeddings_floats",
"id": "0f1b3c6e8d9a4b5c8e7f6a5b4c3d2e1f",
"embeddings": [[0.012, -0.034, ...], [0.041, 0.007, ...]],
"texts": ["Hello world", "Bonjour le monde"],
"meta": {
"api_version": {"version": "1"},
"billed_units": {"input_tokens": 8}
}
}
How It Works¶
Requests are served by the same Bedrock embedding backends as the OpenAI-compatible Embeddings API, with automatic multi-region routing and failover across the regions where the selected model is available.
- When both
textsandimagesare provided, embeddings are returned in request order: all texts first, then all images. - Guardrail and performance headers available on the OpenAI-compatible Embeddings API work on this route too.
Billing¶
Requests are billed through Bedrock (per token), not in Cohere search units; billed_units.input_tokens reports the Bedrock-metered input tokens. Usage appears in usage logs and cost tracking as input_tokens.