API reference · Alibaba
alibaba/text-embedding-v4
Integrate this model through SandBase's unified API, with production-ready schemas and examples.
Production endpoint
Send your first request
OpenAI-compatible endpoint with unified authentication and usage tracking.
POST
https://api.sandbase.ai/v1/embeddingsModel ID
alibaba/text-embedding-v401
Input Schema
3 parameters · 1 required · 2 optional
| Parameter | Type | Required | Description |
|---|---|---|---|
input | union | Required | Text or list of texts to embed. Each item supports up to 8192 tokens. |
dimensions | integer | Optional | Output embedding dimension. · Options: 2048, 1536, 1024, 768, 512, 256, 128, 64 · Default: 1024 20481536102476851225612864 |
encoding_format | string | Optional | Options: float · Default: "float" float |
02
Output Schema
| Field | Type | Description |
|---|---|---|
object | string | Object type: "list" |
data | array | Array of embedding objects |
data[].embedding | number[] | The embedding vector |
data[].index | integer | Index of the input text |
model | string | Model used |
usage.prompt_tokens | integer | Tokens in the input |
usage.total_tokens | integer | Total tokens used |
03
Code Examples
Ready-to-run snippets
const apiKey = process.env.SANDBASE_API_KEY;
const response = await fetch("https://api.sandbase.ai/v1/embeddings", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "alibaba/text-embedding-v4",
"input": "SandBase provides a unified API for AI models, agents, and developer tools.",
"dimensions": 1024,
"encoding_format": "float"
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());