Skip to main content

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

ParameterTypeRequiredNotes
modelstringyesAn embedding alias, currently embed-small (1,536 dimensions). Embedding models carry "embedding": true in GET /v1/models.
inputstring, array of strings, or token array(s)yesAll OpenAI input forms are accepted.
encoding_formatstringnofloat (default) or base64.
dimensionsintegernoForwarded to the model where supported.
userstringnoForwarded.

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: usage has prompt_tokens and total_tokens, no completion tokens.
  • Chat models can't embed and embedding models can't chat; sending embed-small to /v1/chat/completions fails upstream.
  • Errors follow the standard taxonomy in Errors; upstream provider errors are relayed with their original status codes.