Embed API (Ollama Compatible)¶
Generate vector embeddings for semantic search and RAG applications with Amazon Bedrock embedding models through the Ollama /api/embed interface.
This is an alternate route to the OpenAI-compatible Embeddings API: both are served by the same embedding backends and models. Served under /ollama by default; the examples below use $BASE, which includes that prefix.
At a glance¶
- Drop-in Ollama compatibility — Follows the Ollama
/api/embedrequest and response shape, so an existing Ollama embedding client works by changing the base URL. - Semantic search — Turn one or several texts into dense vectors for similarity search that understands meaning, not just keywords.
- Higher RAG quality — Build retrieval pipelines on the same high-quality embedding models served by the OpenAI-compatible Embeddings API.
- Private AWS backend — Served entirely by Amazon Bedrock embedding models in your own AWS account — no traffic to third-party endpoints.
- Differs from the Ollama API:
truncate,keep_aliveandoptionsare accepted and ignored, andload_durationis never reported — see Limits and behaviour to know.
Base URL and route prefix
By default, all Ollama-compatible routes are prefixed with /ollama. This means the Embed API is available at /ollama/api/embed instead of /api/embed. You can customize this prefix using the OLLAMA_ROUTES_PREFIX configuration variable documented in HTTP Server and MCP.
The curl examples on this page use a $BASE variable that must include this prefix — set it to your scheme and host followed by OLLAMA_ROUTES_PREFIX:
export BASE="https://your-host/ollama" # <scheme>://<host> + OLLAMA_ROUTES_PREFIX
curl -X POST "$BASE/api/embed" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "amazon.titan-embed-text-v2:0",
"input": ["first", "second"]
}'
Endpoints¶
| Endpoint | Method | What It Does | Powered By | MCP Tool |
|---|---|---|---|---|
/api/embed | POST | Embed one or several inputs, in request order | Amazon Bedrock embedding models | ollama_embed |
/api/embeddings | POST | Legacy single-prompt embed, deprecated upstream | Amazon Bedrock embedding models | ollama_embeddings |
Model Names¶
Send the model names GET /api/tags publishes — those are the canonical identifiers this server resolves directly. A trailing :latest is accepted and stripped as a fallback when the exact name is not found. Short aliases accepted on this server's other APIs also work here even though /api/tags does not list them. A name learned from ollama.com is not available through this server and answers 404. /api/embed echoes the model name exactly as the request spelled it, in model; the legacy /api/embeddings returns the vector alone, as it does upstream.
Find compatible models: Call /search_models with route=ollama_embed to discover model IDs that support embeddings.
Feature compatibility¶
| Feature | Status | Notes |
|---|---|---|
| Input | ||
input (string) | Full support | |
input (array) | One vector per entry, returned in request order | |
dimensions | Sets the vector width on models that support dimension reduction | |
truncate | Accepted and ignored | |
keep_alive | Accepted and ignored — models are never resident | |
options | Accepted and ignored — no runner options apply to embeddings | |
| Extra model-specific params | Extra fields are forwarded as additional model request parameters | |
| Output | ||
embeddings | One vector per input, in request order | |
total_duration | Real wall-clock time | |
prompt_eval_count | Real input token count | |
load_duration | Never reported — there is no model-loading phase to measure |
Legend:
- Supported — Fully compatible with the Ollama API
- Available on Select Models — Check your model's capabilities
- Unsupported — Not available in this implementation
- Extra Feature — Enhanced capability beyond the Ollama API
Ollama Legacy Embeddings API (/api/embeddings)¶
/api/embeddings is the singular form Ollama itself has deprecated in favor of /api/embed. It takes a single prompt instead of input, embeds it against the same models, and returns only the vector — no token count, no duration:
curl -X POST "$BASE/api/embeddings" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "amazon.titan-embed-text-v2:0",
"prompt": "first"
}'
{"embedding": [0.012, -0.034, ...]}
Deprecated
Prefer /api/embed: it embeds several inputs in one call and reports token usage, which /api/embeddings cannot.
How It Works¶
Requests are served by the same embedding backends and models as the OpenAI-compatible Embeddings API — anything supported there through model is reachable here through the same identifier.
Limits and behaviour to know¶
truncate,keep_aliveandoptionsare accepted and ignored.load_durationis never reported: there is no model-loading phase to measure, and a number there would be invented./api/embeddingsnever reportsprompt_eval_countortotal_duration— it only ever returns the vector, matching Ollama's own legacy response shape.- A model name learned from ollama.com names nothing this server serves and answers
404; send a nameGET /api/tagspublishes.
Request headers¶
| Header | Purpose | Notes |
|---|---|---|
Authorization | Gateway API key | Bearer <key>, required like every other route |
A local Ollama server needs no key; this one does, on every route.
Try it¶
curl -X POST "$BASE/api/embed" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "amazon.titan-embed-text-v2:0",
"input": ["first", "second"]
}'
Example response:
{
"model": "amazon.titan-embed-text-v2:0",
"embeddings": [[0.012, -0.034, ...], [0.041, 0.007, ...]],
"total_duration": 214567890,
"prompt_eval_count": 4
}
Next steps¶
Next: Chat API · Models API · OpenAI Embeddings API · Search Models API