inferenceClient.embeddings.create()

Generated on 27 Oct 2026 from DoTs version v1.21.0

Usage

inferenceClient.embeddings.create(params: Record<string, any>): Promise<any>

Description

Create vector embeddings for one or more text inputs. OpenAI-compatible request and response. Unknown fields in the request body are rejected. There is no streaming response for this endpoint.

Parameters

model string required

Example: qwen3-embedding-0.6b

Model id to use for embeddings. Must match a model your account can access.

input string or array of strings required

Example: hello world

A single string or 1, 2048 strings; each string produces one row in data, in order.

user string optional

Example: user-1234

Optional end-user identifier to help with abuse monitoring.

encoding_format string optional

How embedding values are returned in each data[].embedding field.

One of: float, base64

Default: float

Request Sample

Show Request Sample
import { InferenceClient } from "@digitalocean/dots";

const inferenceClient = new InferenceClient({
    apiKey: process.env.MODEL_ACCESS_KEY!,
});

const response = await inferenceClient.embeddings.create({
    model: "qwen3-embedding-0.6b",
    input: "hello world",
    user: "user-1234",
    encoding_format: "float",
});

Response Example

Show Response Example
{
  "object": "list",
  "model": "qwen3-embedding-0.6b",
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [
        0.0123,
        -0.0456,
        0.0001
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 6,
    "total_tokens": 6
  }
}

More Information

See /v1/embeddings in the API reference for additional detail on responses, headers, parameters, and more.

We can't find any results for your search.

Try using different keywords or simplifying your search terms.