Create vector embeddings from text
curl --request POST \
--url https://modelswitch.io/v1/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"encoding_format": "<string>"
}
'{
"object": "<string>",
"data": [
{
"object": "<string>",
"index": 123,
"embedding": [
{}
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
}
}Authorization: Bearer ms-YOUR_KEY
text-embedding-3-small."float" (array of numbers) or "base64" (base64-encoded string).curl https://modelswitch.io/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ms-YOUR_KEY" \
-d '{
"model": "text-embedding-3-small",
"input": "The quick brown fox",
"encoding_format": "float"
}'
{
"model": "text-embedding-3-small",
"input": "The quick brown fox",
"encoding_format": "float"
}
{
"object": "list",
"data": [{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0091, 0.0156, "... 1536 dimensions"]
}],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 5,
"total_tokens": 5
}
}
data array preserves the input order via the index field.
{
"model": "text-embedding-3-small",
"input": ["First sentence", "Second sentence", "Third sentence"]
}
"list".| Model | Dimensions | Notes |
|---|---|---|
text-embedding-3-small | 1536 | Cost-effective, recommended for most use cases |
text-embedding-3-large | 3072 | Higher quality, better for precision-sensitive tasks |
text-embedding-ada-002 | 1536 | Legacy model |
GET /v1/models for the full, up-to-date list of available embedding models.curl --request POST \
--url https://modelswitch.io/v1/embeddings \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"encoding_format": "<string>"
}
'{
"object": "<string>",
"data": [
{
"object": "<string>",
"index": 123,
"embedding": [
{}
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
}
}