---
title: pydo.embeddings.create()
description: Create embedding
product: Reference
url: https://docs.digitalocean.com/reference/pydo/reference/inference/create_embedding/
last_updated: "2026-10-01"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](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 1 Oct 2026 from `pydo` version [`v0.43.0`](https://github.com/digitalocean/pydo/releases/tag/v0.43.0v0.43.0)

## Usage

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

Returns `JSON`Raises `HttpResponseError`

Serverless inference methods can authenticate with a [model access key](https://docs.digitalocean.com/products/inference/how-to/manage-model-access-keys/index.html.md) instead of a DigitalOcean API token:

```python
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 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

```python
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

```json
{
  "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`](https://docs.digitalocean.com/reference/api/reference/serverless-inference/index.html.md#inference_create_embedding) in the API reference for additional detail on responses, headers, parameters, and more.