API reference
Embeddings
Turn text into vectors for search, clustering and retrieval.
POST /v1/embeddings takes OpenAI's request and returns its response, so client.embeddings.create() works with the same key and base URL as chat.Create embeddings#
POST/v1/embeddings
Request body
modelstringrequired- An embedding model ID from the list below, or
GET /v1/models?kind=embedding. inputstring | arrayrequired- The text to embed: one string, or an array of up to 2,048 non-empty strings to embed in one call. Arrays of token IDs (or of token-ID arrays) are accepted too. Each input must fit the model's context window.
encoding_formatstringfloat(the default) returns each vector as an array of numbers.base64returns it as a base64 string of little-endian 32-bit floats, smaller on the wire. The OpenAI SDKs ask forbase64behind the scenes and decode it, so you get numbers either way unless you ask for it yourself.dimensionsinteger- A shorter vector of this many numbers, for models that support it. Passed to the model as sent; one that can't do it may ignore it or answer
400 invalid_request_error. userstring- Accepted and ignored.
The usual headers come back: x-request-id and the rate-limit headers. Rate limits, spend caps, project budgets and model locks apply exactly as they do to chat.
curl https://fullsendai.com/v1/embeddings \ -H "Authorization: Bearer $FULLSEND_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "bge-m3", "input": ["How do I reset my password?", "Billing runs on the 1st of each month."] }'Response
{ "object": "list", "data": [ { "object": "embedding", "index": 0, "embedding": [-0.0403, 0.0370, -0.0289, …] }, { "object": "embedding", "index": 1, "embedding": [-0.0295, 0.0064, -0.0729, …] } ], "model": "bge-m3", "usage": { "prompt_tokens": 18, "total_tokens": 18 }}The response#
objectstring- Always
list. data[]array- One
{"object": "embedding", "index", "embedding"}per input.indexis the input's position in your array;embeddingis an array of numbers, or a base64 string withencoding_format: "base64". modelstring- The FullsendAI model ID you called.
usage.prompt_tokensinteger- Input tokens, as billed.
total_tokensis the same number: embeddings have no output.
import base64, structresult = client.embeddings.create(model="bge-m3", input="hello", encoding_format="base64")raw = base64.b64decode(result.data[0].embedding)vector = struct.unpack(f"<{len(raw) // 4}f", raw) # little-endian float32Batching and limits#
- Up to 2,048 inputs a call. Batching is the cheap way to embed a corpus: one request counts once against your rate limit, whatever its size. Split larger jobs into chunks of 2,048 or fewer.
- Each input fits the context window. A longer one is refused by the model with
400 invalid_request_error; chunk long documents before embedding them. - Kinds don't mix. An embedding model called at
/v1/chat/completions, or a chat model here, answers400 invalid_model_kindwith the endpoint it belongs to. See Errors. - Failover applies. When a model's host fails, the call moves to its backup at the same price. See Reliability and routing.
Embedding models#
No embedding model is live just now. Ask
GET /v1/models?kind=embedding for the current list.GET /v1/models lists chat models by default, since tools fill their model pickers from it. Add ?kind=embedding for these, or ?kind=all for everything; see Models.
curl
curl "https://fullsendai.com/v1/models?kind=embedding" -H "Authorization: Bearer $FULLSEND_API_KEY"Pricing#
You pay for input tokens only, at the model's input price per million; there are no output tokens. The tokens billed are usage.prompt_tokens. A call costs at least one micro-dollar, and each one shows on its row in Logs with its cost. Plan allowance is spent first, then your prepaid balance, as with chat; see Pricing and billing.
Stuck? Email [email protected]System statusChangelog