For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
ModelsChatRankingsDocs
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
DocsAPI ReferenceClient SDKsAgent SDKCookbookChangelog
  • API Guides
    • Overview
    • Streaming
    • Embeddings
    • Limits
    • Authentication
    • Parameters
    • Errors and Debugging
  • API Reference
      • POSTSubmit an embedding request
      • GETList all embeddings models
LogoLogo
ModelsChatRankingsDocs
API ReferenceEmbeddings

Submit an embedding request

POST
https://openrouter.ai/api/v1/embeddings
POST
/api/v1/embeddings
$curl -X POST https://openrouter.ai/api/v1/embeddings \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "input": "The quick brown fox jumps over the lazy dog",
> "model": "openai/text-embedding-3-small",
> "dimensions": 1536
>}'
1{
2 "data": [
3 {
4 "embedding": [
5 0.0023064255,
6 -0.009327292,
7 0.015797347
8 ],
9 "object": "embedding",
10 "index": 0
11 }
12 ],
13 "model": "openai/text-embedding-3-small",
14 "object": "list",
15 "usage": {
16 "prompt_tokens": 8,
17 "total_tokens": 8
18 }
19}
Submits an embedding request to the embeddings router
Was this page helpful?
Previous

List all embeddings models

Next
Built with

Authentication

AuthorizationBearer
API key as bearer token in Authorization header

Request

Embeddings request input
inputstring or list of strings or list of doubles or list of lists of doubles or list of objectsRequired

Text, token, or multimodal input(s) to embed

modelstringRequired
The model to use for embeddings
dimensionsintegerOptional>=1
The number of dimensions for the output embeddings
encoding_formatenumOptional
The format of the output embeddings
Allowed values:
input_typestringOptional

The type of input (e.g. search_query, search_document)

providerobjectOptional
Provider routing preferences for the request.
userstringOptional

A unique identifier for the end-user

Response

Embedding response
datalist of objects
List of embedding objects
modelstring
The model used for embeddings
objectenum
Allowed values:
idstring
Unique identifier for the embeddings response
usageobject
Token usage statistics

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error
503
Service Unavailable Error