<!-- Lazu · BAAI/bge-m3 embeddings API: 100+ languages, $0.02 per 1M · https://lazu.ai/blog/bge-m3-embedding-api -->

# BAAI/bge-m3 embeddings API: 100+ languages, $0.02 per 1M

2026-10-28 · Lazu team

`BAAI/bge-m3` is available on Lazu through the OpenAI-compatible `/v1/embeddings` endpoint at **$0.02 per million input tokens**. It returns 1024-dimension vectors, accepts up to 8,192 tokens per input and puts more than 100 languages into one vector space. Embedding 10,000 documents of 500 tokens each costs about **$0.10**.

Model: `BAAI/bge-m3` — Stable — — https://lazu.ai/models/baai/BAAI/bge-m3

## What bge-m3 is

bge-m3 is an open-weights embedding model from BAAI, the Beijing Academy of Artificial Intelligence, published in January 2024 under the MIT license. "M3" stands for multi-linguality (100+ languages), multi-granularity (from a short sentence to an 8,192-token document) and multi-functionality (dense, sparse and multi-vector retrieval). Lazu's `/v1/embeddings` returns the dense vector, the form vector databases and RAG frameworks expect. Details are in the [model card](https://huggingface.co/BAAI/bge-m3) and the [paper](https://arxiv.org/abs/2402.03216).

## At a glance

| | `BAAI/bge-m3` on Lazu |
| --- | --- |
| Endpoint | `POST /v1/embeddings`, OpenAI-compatible |
| Price | $0.02 per million input tokens; embeddings have no output tokens |
| Vector size | 1024, fixed |
| Max tokens per input | 8,192 |
| Languages | 100+, one shared vector space |
| `dimensions`, `encoding_format: base64` | Ignored: always 1024 floats |
| Batch | An array of inputs per request (we tested 50) |

## Call it

Any OpenAI SDK works: point `base_url` at Lazu and use the model ID `BAAI/bge-m3`.

```bash
curl https://api.lazu.ai/v1/embeddings \
  -H "Authorization: Bearer $LAZU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "BAAI/bge-m3", "input": ["How do I reset my password?", "如何重置密码？"]}'
```

```python
from openai import OpenAI

client = OpenAI(base_url="https://api.lazu.ai/v1", api_key="YOUR_LAZU_KEY")
resp = client.embeddings.create(
    model="BAAI/bge-m3",
    input=["How do I reset my password?", "如何重置密码？"],
)
print(len(resp.data[0].embedding), resp.usage.prompt_tokens, resp.usage.cost)
```

The response has one vector per input in input order, `model` set to `BAAI/bge-m3`, and `usage` with `prompt_tokens`, `total_tokens` and `cost` in USD.

## Search across languages

Because every language lands in the same space, an English question finds a Chinese or Japanese answer without translating anything:

```python
import numpy as np

docs = [
    "Reset your password from Settings → Security.",
    "账单每月 1 日生成，可在控制台下载发票。",
    "API キーはプロジェクトごとに発行できます。",
]

def embed(texts):
    resp = client.embeddings.create(model="BAAI/bge-m3", input=texts)
    vectors = np.array([item.embedding for item in resp.data])
    return vectors / np.linalg.norm(vectors, axis=1, keepdims=True)

scores = embed(docs) @ embed(["Where can I download my invoice?"])[0]
print(docs[int(scores.argmax())])  # the Chinese invoice sentence
```

## Limits and errors

- **An input over 8,192 tokens** is refused with `400 context_length_exceeded` (LZ-1005) and costs nothing. Chunk long documents first; chunks of a few hundred to a thousand tokens usually retrieve better anyway.
- **An empty string** is refused with a 400. Drop empty chunks before you send them.
- **`dimensions` and `encoding_format: base64` are ignored.** You always get 1024 floats. The [catalog](https://lazu.ai/models) lists both under `unsupported_params` for this model.

## What you are billed

Only input tokens are billed, and failed requests cost nothing. The provider behind this model does not report a token count, so Lazu counts the input with a standard tokenizer. That count differs from bge-m3's own tokenizer by roughly a fifth to a quarter: lower for English text, higher for Chinese. At $0.02 per million tokens, that gap is worth at most about $0.005 per million tokens embedded.

Every response carries the charge in `usage.cost` and in the `x-lazu-cost-usd` header. What we measured on October 29, 2026:

| Request | Billed tokens | Charge |
| --- | --- | --- |
| One short English sentence | 7 | $0.000001 (minimum per request) |
| English text, 10,500 characters | 1,948 | $0.000039 |
| Chinese text, 2,880 characters | 3,053 | $0.000061 |
| Batch of 20 short documents | 260 | $0.000005 |

## bge-m3 or text-embedding-3-small?

| | `BAAI/bge-m3` | `text-embedding-3-small` |
| --- | --- | --- |
| Price on Lazu | $0.02 / 1M tokens | $0.02 / 1M tokens |
| Vector size | 1024 | 1536, can be shortened |
| Max tokens per input | 8,192 | 8,191 |
| Weights | Open, MIT license | Closed |

Pick bge-m3 for Chinese, Japanese or mixed-language content, or when a smaller index matters: 1024 dimensions take a third less storage than 1536. Keep text-embedding-3-small if your index already holds its vectors. Vectors from different models cannot be compared, so switching models means re-embedding the whole corpus.

The full request and response reference is in the [embeddings docs](https://lazu.ai/docs/endpoints/embeddings).

