[ Web Proxy ]
URL:
Viewing: https://docs.digitalocean.com/reference/pydo/reference/inference/create_embedding/ [Back]  [Original]

pydo.embeddings.create() | DigitalOcean Documentation

For AI agents: The documentation index is at https://docs.digitalocean.com/llms.txt. Markdown versions of pages use the same URL with index.html.md in place of the HTML page (for example, append index.html.md to the directory path instead of opening the HTML document).

pydo.embeddings.create()

Generated on 3 Aug 2026 from pydo version v0.40.0

Copy page as Markdown View page as Markdown

Usage

client.embeddings.create(
    model="qwen3-embedding-0.6b",
    input=["hello world", "goodbye world"],
    encoding_format="float",
    user="user-1234",
)
Returns JSONRaises HttpResponseError

Serverless inference methods can authenticate with a model access key instead of a DigitalOcean API token:

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

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 object required

Example: hello world

A single string or 12048 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 os
from pydo import Client

client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))

resp = client.embeddings.create(
    model="qwen3-embedding-0.6b",
    input=["hello world", "goodbye world"],
    encoding_format="float",
    user="user-1234",
)

for item in resp.data:
    print(item.index, item.embedding[:8])

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.

In this article...


We can't find any results for your search.

Try using different keywords or simplifying your search terms.


Web Proxy Viewer  |  New URL  |  Original Page