Documentation
Everything you need to integrate EmbedRoute into your application.
Quickstart
EmbedRoute is OpenAI SDK compatible. If you're already using OpenAI embeddings, integration takes two lines of code.
JavaScript / TypeScript
import OpenAI from 'openai'
const client = new OpenAI({
apiKey: 'er_your_api_key', // Your EmbedRoute API key
baseURL: 'https://api.embedroute.com/v1' // EmbedRoute endpoint
})
const response = await client.embeddings.create({
model: 'openai/text-embedding-3-small',
input: 'Your text to embed'
})
console.log(response.data[0].embedding)Python
from openai import OpenAI
client = OpenAI(
api_key="er_your_api_key",
base_url="https://api.embedroute.com/v1"
)
response = client.embeddings.create(
model="openai/text-embedding-3-small",
input="Your text to embed"
)
print(response.data[0].embedding)Authentication
All API requests require an API key. Include your key in the Authorization header.
HTTP Header
Authorization: Bearer er_your_api_keyTip: Your API key starts with er_. Keep it secret and never expose it in client-side code.
Create Embeddings
Generate embeddings for text input. The response format matches the OpenAI API.
Endpoint
POSThttps://api.embedroute.com/v1/embeddingsRequest Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (e.g., openai/text-embedding-3-small) |
input | string | array | Yes | Text to embed. Can be a string or array of strings. |
dimensions | integer | No | Output dimensions (only supported by some models) |
Example Request
cURL
curl https://api.embedroute.com/v1/embeddings \
-H "Authorization: Bearer er_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog"
}'Example Response
JSON
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0142, 0.0841, ...]
}
],
"model": "openai/text-embedding-3-small",
"usage": {
"prompt_tokens": 9,
"total_tokens": 9
}
}Supported Models
Use the provider/model format when specifying a model.
| Provider | Model ID | Dimensions | Max Tokens |
|---|---|---|---|
| OpenAI | openai/text-embedding-3-small | 1,536 | 8,191 |
| OpenAI | openai/text-embedding-3-large | 3,072 | 8,191 |
| OpenAI | openai/text-embedding-ada-002 | 1,536 | 8,191 |
| Voyage | voyage/voyage-3 | 1,024 | 32,000 |
| Voyage | voyage/voyage-3-lite | 512 | 32,000 |
| Voyage | voyage/voyage-code-3 | 1,024 | 32,000 |
| Cohere | cohere/embed-english-v3.0 | 1,024 | 512 |
| Cohere | cohere/embed-multilingual-v3.0 | 1,024 | 512 |
| Mistral | mistral/mistral-embed | 1,024 | 8,192 |
Error Handling
EmbedRoute returns standard HTTP status codes and JSON error responses.
| Status | Description |
|---|---|
200 | Success |
400 | Bad request – invalid parameters |
401 | Unauthorized – invalid or missing API key |
402 | Payment required – insufficient credits |
429 | Rate limit exceeded |
500 | Server error |
Error Response Format
{
"error": {
"message": "Invalid API key provided",
"type": "authentication_error",
"code": "invalid_api_key"
}
}Rate Limits
Rate limits depend on your plan. Headers indicate your current usage.
| Header | Description |
|---|---|
X-RateLimit-Limit | Requests allowed per minute |
X-RateLimit-Remaining | Requests remaining this minute |
X-RateLimit-Reset | Unix timestamp when limits reset |
Need higher limits? Contact us at support@embedroute.com for enterprise plans with custom rate limits.