Multimodal
Embeddings
Turn text, token arrays, images and PDFs into vectors with POST /embeddings for search, clustering, deduplication and retrieval.
POST /embeddings follows the OpenAI request and response shapes, so the official SDKs work after you change the base URL and key. Batch up to 2,048 inputs per request, choose float or compact base64 output, and embed images and PDFs with multimodal models.
Text inputs preserve JSON-escaped control characters, including terminal escapes. Input and request size limits still apply.
Each input accepts at most 4 MiB of combined text in UTF-8 bytes. A multimodal input accepts up to 128 content parts across text, images, PDFs and audio, subject to media size limits and the selected model's supported inputs.
Create embeddings
curl -X POST "https://api.numes.ai/api/v1/embeddings" \ -H "Authorization: Bearer $NUMES_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "author/embedding-model", "input": [ "How do I reset my password?", "Steps to recover a locked account", "Quarterly revenue grew by 12 percent" ] }'The response holds one vector per input, in input order. Real vectors have hundreds or thousands of dimensions:
{ "id": "embd-3f0c6a5e-9d7b-4c1e-8a2f-6b5d4e3c2a10", "object": "list", "model": "author/embedding-model", "data": [ { "object": "embedding", "index": 0, "embedding": [0.0213, -0.0447, 0.0182, 0.0031] }, { "object": "embedding", "index": 1, "embedding": [0.0198, -0.0402, 0.0211, -0.0007] }, { "object": "embedding", "index": 2, "embedding": [-0.0315, 0.0126, -0.0088, 0.0402] } ], "usage": { "prompt_tokens": 21, "total_tokens": 21, "cost": 0.000002 }}Response body
idstringembd-followed by the generation ID, which also appears in theX-Generation-Idheader.object"list"Always
list.modelstringThe canonical model ID that served the request.
dataobject[]One entry per input item, sorted by
index.Show child attributesHide child attributes
object"embedding"Always
embedding.indexintegerPosition of the input item, from 0.
embeddingnumber[] | stringThe vector: an array of numbers for
float, or a base64 string forbase64.
usageobjectUsage for the request.
Show child attributesHide child attributes
prompt_tokensintegerInput tokens for the whole batch.
total_tokensintegerEqual to
prompt_tokens; embeddings produce no output tokens.costnumberTotal charge in your key's currency.
Request fields
Request body
modelstringRequiredCanonical ID of an embedding model, such as
author/embedding-model.inputstring | string[] | integer[] | integer[][] | ContentPart[][]RequiredWhat to embed. See Input formats.
dimensionsintegerLength of the returned vectors, from 1 to 65,536, for models that can shorten their output.
encoding_formatstringDefaultfloatfloatfor arrays of numbers, orbase64for packed little-endian float32 vectors.input_typestringTask hint, such as a query or document type. Accepted values depend on the model; at most 128 bytes.
providerobjectRouting preferences, as for chat. See Provider routing.
Other fields, including user, are rejected with 400.
Input formats
input shape | Vectors returned | Limits |
|---|---|---|
| A string | 1 | Non-empty, at most 4 MiB |
| An array of strings | One per string | 1–2,048 strings, each non-empty and at most 4 MiB |
| An array of token IDs (non-negative integers) | 1 | At least one token |
| An array of token-ID arrays | One per inner array | 1–2,048 arrays |
| An array of content-part arrays | One per inner array | 1–2,048 items |
The first element decides how an array is read, so don't mix strings with arrays in one input. Token IDs must come from the model's own tokenizer.
Multimodal inputs
Multimodal embedding models place text, images and documents in one vector space. Each item is an array of content parts, using the same text, image_url, file and input_audio parts as chat, and all parts of one item produce one vector:
curl -X POST "https://api.numes.ai/api/v1/embeddings" \ -H "Authorization: Bearer $NUMES_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "author/multimodal-embedding-model", "input": [ [ { "type": "text", "text": "Red trail running shoe, side view" }, { "type": "image_url", "image_url": { "url": "https://example.com/images/shoe.jpg" } } ], [ { "type": "text", "text": "Waterproof hiking boot" } ] ] }'Wrap a single multimodal item in an outer array as well. Media follows the chat media rules: at most 8 MiB per item and 24 MiB in total. A request with images, PDFs or audio needs an endpoint whose input_modalities include image, file or audio. Video is rejected with 400.
Optional controls and routing
dimensions, input_type and encoding_format: "base64" are forwarded to the selected endpoint. To route only to endpoints that declare every one you set in their supported_parameters, add provider.require_parameters: true; if none does, the request fails with 503 provider_unavailable:
curl -X POST "https://api.numes.ai/api/v1/embeddings" \ -H "Authorization: Bearer $NUMES_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "author/embedding-model", "input": "How do I reset my password?", "dimensions": 256, "input_type": "search_query", "provider": { "require_parameters": true } }'encoding_format: "float", or leaving it unset, adds no requirement.
Use the OpenAI SDK
import osfrom openai import OpenAIclient = OpenAI(base_url="https://api.numes.ai/api/v1", api_key=os.environ["NUMES_API_KEY"])response = client.embeddings.create( model="author/embedding-model", input=["How do I reset my password?", "Steps to recover a locked account"], encoding_format="float",)for item in response.data: print(item.index, len(item.embedding))Base64 vectors
With encoding_format: "base64", each embedding is a base64 string of little-endian 32-bit floats, considerably smaller than JSON numbers. Decode it like this:
import base64import numpy as npdef decode_embedding(value: str) -> np.ndarray: return np.frombuffer(base64.b64decode(value), dtype="<f4")Find embedding models
curl "https://api.numes.ai/api/v1/models?output_modalities=embeddings" \ -H "Authorization: Bearer $NUMES_API_KEY"Embedding models have "embeddings": true and embeddings in architecture.output_modalities. To see which endpoints accept image or file input or support dimensions, input_type or encoding_format, read input_modalities and supported_parameters in GET /models/{author}/{slug}/endpoints.
Vectors from different models aren't comparable. Store the model ID with every vector, and re-embed your corpus when you change models. Compare vectors with cosine similarity, or store them in a vector database for nearest-neighbour search.
Batching and limits
| Limit | Value |
|---|---|
| Items per request | 2,048 |
| One string | 4 MiB |
| Request body | 10 MiB |
| Request timeout | 10 minutes |
| Media | 8 MiB per item, 24 MiB per request |
Keep each input within the model's context length. The limit applies per input, not to the whole batch.
Split very large batches. The funds held before a batch runs grow with the number of items, and its tokens count toward your key's token rate limit, so one huge batch can fail with 402 or 429 where several smaller ones pass. See Limits.
Match results by
indexto map each vector back to its input.Use base64 for large batches to shrink the response.
Use a new
X-Request-Idfor each retry. A reused request ID is rejected with 400.
Billing
Embeddings are billed by input at the endpoint's rates, including any per-request and media prices; there are no output tokens. usage.cost is the exact total in your key's currency, and GET /generation is the authoritative record. See Usage accounting.
Errors
| Status | error_type | Cause |
|---|---|---|
| 400 | invalid_request | Empty or malformed input, more than 2,048 items, dimensions outside 1–65,536, unknown encoding_format, video parts, invalid media, unknown field |
| 402 | insufficient_credits | Balance or key limit can't cover the held amount |
| 408 | timeout | The request didn't finish within 10 minutes |
| 413 | payload_too_large | Body larger than 10 MiB |
| 429 | rate_limited | Key or account rate limit; wait for Retry-After |
| 503 | provider_unavailable | No eligible endpoint for the model, its input modalities, required parameters or batch size |