# Embeddings

Use `volcengine/doubao-embedding-vision-251215` on `https://api.xrtoken.net/v1`, or `volcengine-overseas/skylark-embedding-vision-251215` on `https://api.xrtoken.ai/v1`.

```python
import os
from openai import OpenAI

client = OpenAI(api_key=os.environ["XRTOKEN_API_KEY"], base_url="https://api.xrtoken.ai/v1")
result = client.embeddings.create(
    model="volcengine-overseas/skylark-embedding-vision-251215",
    input=["image similarity", "semantic image search"],
    dimensions=1024,
    encoding_format="float",
)
print(result.data[0].embedding)
```

`POST /v1/embeddings` accepts a string or up to 128 strings and returns an independent vector per string in `data[]`, preserving order. Native `POST /v1/embeddings/multimodal` accepts an array of `text`, `image_url`, and `video_url` content objects and returns one fused result in `data.embedding`. The `/api/v3`, `/v3`, and `/api/v1` prefixes are also supported.

Dimensions are 1024 or 2048 (default). Native options including `instructions`, `sparse_embedding`, and `multi_embedding` are forwarded to the provider. Sparse output requires text-only input. Streaming and integer token inputs are unsupported.

Text and visual tokens are priced separately using actual `usage.prompt_tokens_details`. Authenticated `GET /v1/models` exposes `input_per_1m` and `embedding_visual_input_per_1m`, in site currency per million tokens, including account discounts. There is no output-token charge. Funds are reserved before submission and settled from actual usage; failures release reservations. Text batches call the provider separately for each input; a partial failure returns an error and releases the entire batch reservation. Video reservations use the model context limit unless a valid `max_video_tokens` limit is provided.

Use `X-Request-Id` with `GET /v1/credits/requests/{requestId}` to inspect billing. Legacy `doubao-embedding` and `doubao-embedding-large` are disabled because the current supplier account cannot access them. They are never silently mapped onto the new model. Changing embedding models requires rebuilding existing vector indexes.

See [Text API](/docs/en/api/createEmbedding) and [Multimodal API](/docs/en/api/createMultimodalEmbedding).
