Embeddings
POST /v1/embeddings follows the OpenAI embeddings shape.
curl https://api.mindshub.ai/v1/embeddings \
-H "Authorization: Bearer $MINDSHUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "embed-small", "input": "The quick brown fox"}'
{
"object": "list",
"data": [
{"object": "embedding", "index": 0, "embedding": [0.0123, -0.0456, 0.0789]}
],
"model": "text-embedding-3-small",
"usage": {"prompt_tokens": 4, "total_tokens": 4}
}
(The real embedding array has 1,536 values; it's truncated here.)
With the OpenAI SDK:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.mindshub.ai/v1",
api_key=os.environ["MINDSHUB_API_KEY"],
)
response = client.embeddings.create(model="embed-small", input=["first text", "second text"])
vectors = [item.embedding for item in response.data]
Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
model | string | yes | An embedding alias, currently embed-small (1,536 dimensions). Embedding models carry "embedding": true in GET /v1/models. |
input | string, array of strings, or token array(s) | yes | All OpenAI input forms are accepted. |
encoding_format | string | no | float (default) or base64. |
dimensions | integer | no | Forwarded to the model where supported. |
user | string | no | Forwarded. |
Billing and limits
- Embeddings always bill to the wallet and never draw included tokens: an empty wallet refuses them like any other paid request. The rate is low ($0.02 per million tokens), but it isn't free.
- Embedding calls are input-only:
usagehasprompt_tokensandtotal_tokens, no completion tokens. - Chat models can't embed and embedding models can't chat; sending
embed-smallto/v1/chat/completionsfails upstream. - Errors follow the standard taxonomy in Errors; upstream provider errors are relayed with their original status codes.