Text Embedding v4 API

Multilingual text embedding with selectable output dimensions (64–2048). Up to 8,192 tokens per input.

Alibaba Cloud Embeddings 8K context Released Jun 4, 2025 Singapore Proprietary Endpoint

About Text Embedding v4

Multilingual text embedding with selectable output dimensions (64–2048). Up to 8,192 tokens per input.

Also known as Text Embedding, Alibaba Cloud Text Embedding v4

custom dimensions sparse vectors task instructions batch

Text Embedding v4 specs

Model ID
text-embedding-v4
Author
Alibaba Cloud
Category
Embeddings
Released
Jun 4, 2025
Context window
8K tokens
Input
Text
Output
Embedding
Region
Singapore
Endpoints
POST/v1/embeddings

Text Embedding v4 API pricing

Live pay-as-you-go rates from the EmpirioLabs catalog. You are billed only for what you use, with no monthly minimum.

Type
Spec
Rate
Input
per 1M prompt tokens
$0.07
Compare on the full pricing page

How to call the Text Embedding v4 API

Text Embedding v4 serves the OpenAI-compatible Embeddings API. Point any OpenAI SDK at https://api.empiriolabs.ai/v1 and use the model id text-embedding-v4. Get an API key from the EmpirioLabs dashboard.

cURL
curl https://api.empiriolabs.ai/v1/embeddings \
  -H "Authorization: Bearer $EMPIRIOLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-v4",
    "input": "The quick brown fox jumps over the lazy dog."
  }'
Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.empiriolabs.ai/v1",
    api_key="YOUR_EMPIRIOLABS_API_KEY",
)

embedding = client.embeddings.create(
    model="text-embedding-v4",
    input="The quick brown fox jumps over the lazy dog.",
)
print(embedding.data[0].embedding[:8])
Full Text Embedding v4 API reference

Text Embedding v4 API parameters

Request parameters supported by the Text Embedding v4 API on EmpirioLabs. Defaults apply when a field is omitted.

ParameterTypeDefaultRange / valuesDescription
inputstring--Text or array of up to 2,048 texts to embed, 8,192 tokens each.
dimensionsnumber10242048, 1536, 1024, 768, 512, 256, 128, 64Vector dimension. Higher = more semantic info, more storage cost.
encoding_formatenumfloatfloat, base64Embedding output format: float (default array of floats) or base64.
userstring--Optional identifier for the end user making the request.
output_typeenumdensedense, sparse, dense_and_sparsedense returns the vector in embedding, sparse returns token weights in sparse_embedding, and dense_and_sparse returns both. Every output type bills the same tokens.
instructstring--An instruction describing the search task, such as: Given a web search query, retrieve relevant passages that answer the query. Set it when embedding search queries...

Good to know

Output dimensions (selectable per request)

  • 64, 128, 256, 512, 768, 1024 (default), 1536, 2048
  • Higher dimensions retain more semantic detail at higher storage cost

Sparse vectors (output_type)

  • dense (default) returns the vector in embedding
  • sparse returns token weights in sparse_embedding, each with index, value and token, and an empty embedding
  • dense_and_sparse returns both
  • Every output type bills the same tokens

Query instructions (instruct)

  • Describes the search task for a query embedding, such as "Given a web search query, retrieve relevant passages that answer the query"
  • Set it when embedding search queries; leave it out for documents
  • Its tokens bill as input

Batch

  • Up to 2,048 inputs per request, 8,192 tokens each

Languages

  • 100+ natural languages including Chinese, English, Spanish, French, Japanese, Korean, German, Russian, plus most common programming languages

Text Embedding v4 API: common questions

How much does the Text Embedding v4 API cost?

On EmpirioLabs, Text Embedding v4 is billed pay as you go: Input $0.07 per 1M prompt tokens. The live rate card on this page always matches what the API charges.

What is the context window of Text Embedding v4?

Text Embedding v4 supports a 8K-token context window.

Which endpoint does Text Embedding v4 use?

Text Embedding v4 is served through POST /v1/embeddings on api.empiriolabs.ai with standard bearer-token authentication.

Can I try Text Embedding v4 in the browser before integrating?

Yes. The EmpirioLabs playground runs Text Embedding v4 in the browser with the same parameters the API exposes, so you can test prompts before writing code.

How do I get a Text Embedding v4 API key?

Create an EmpirioLabs account, then generate a key under API Keys in the dashboard. Billing is pay-as-you-go credits, so you only pay for the requests you make.

Ready to use better endpoints?

Check out our pricing or reach out if you want your own model deployed on our stack.