For the complete documentation index, see llms.txt. This page is also available as Markdown.

Embeddings

Generate vector embeddings for text. The API is compatible with the OpenAI Embeddings format, so you can use existing OpenAI SDKs by changing the base URL.

Embeddings are dense vector representations of text, useful for semantic search, clustering, retrieval-augmented generation (RAG), classification, and similarity comparison.

Endpoint

POST https://api.dos.ai/v1/embeddings

Authentication

Include your API key in the Authorization header using the Bearer scheme:

Authorization: Bearer dos_sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

API keys can be created and managed from the dashboard.

Request Headers

Header
Required
Description

Authorization

Yes

Bearer YOUR_API_KEY

Content-Type

Yes

application/json

Request Body

Parameter
Type
Required
Default
Description

model

string

Yes

-

The embedding model ID. Use qwen3-embedding-4b.

input

string or array

Yes

-

The text to embed. Pass a single string, or an array of strings to embed many at once (batch).

encoding_format

string

No

float

Format of the returned vectors: float (array of numbers) or base64.

Response Body

Response Fields

Field
Type
Description

object

string

Always "list".

data

array

One embedding object per input. Order matches the input array.

data[].index

integer

Position of this embedding in the input list.

data[].embedding

array

The embedding vector (2560 dimensions for qwen3-embedding-4b).

model

string

The embedding model used.

usage.prompt_tokens

integer

Number of input tokens embedded.

usage.total_tokens

integer

Total tokens billed.

Model

Model
Dimensions
Model ID

Qwen3-Embedding-4B

2560

qwen3-embedding-4b

Served in FP16 on dedicated GPUs in Asia-Southeast, with an automatic cloud fallback for high availability. Embeddings are not affected by smart routing (dos-auto) or BYOK - they are always served on DOS AI infrastructure.

Examples

cURL

Batch (multiple inputs)

Using the OpenAI Python SDK

Using the OpenAI Node.js SDK

Error Responses

Status Code
Error
Description

400

Bad Request

Invalid request parameters (e.g. missing input).

401

Unauthorized

Invalid or missing API key.

402

Payment Required

Insufficient credits.

429

Too Many Requests

Rate limit exceeded. See Rate Limits.

503

Service Unavailable

Embedding backend temporarily unavailable.

See Error Codes for detailed troubleshooting.

Last updated