# Embeddings (/api-v1/embeddings)



Create embedding vectors for text. The request and response match OpenAI's embeddings shape, so an existing client works after a base-URL swap.

## Create embeddings [#create-embeddings]

```
POST https://api.zumik.ai/v1/embeddings
```

### Parameters [#parameters]

<ParamField body="model" type="string">
  A Zumik [alias](/concepts/model-aliases) or a concrete provider embeddings model.
</ParamField>

<ParamField body="input" type="string | array">
  A single string, or a non-empty array of strings to embed. An empty input is rejected with `400`.
</ParamField>

### Request [#request]

<CodeGroup>
  ```bash title="curl"
  curl https://api.zumik.ai/v1/embeddings \
    -H "Authorization: Bearer zk_live_..." \
    -H "Content-Type: application/json" \
    -d '{"model":"auto.cheapest","input":["first chunk","second chunk"]}'
  ```

  ```python title="OpenAI SDK"
  from openai import OpenAI

  client = OpenAI(base_url="https://api.zumik.ai/v1", api_key="zk_live_...")

  res = client.embeddings.create(
      model="auto.cheapest",
      input=["first chunk", "second chunk"],
  )
  print(res.data[0].embedding)
  ```

  ```python title="Zumik SDK"
  from zumik import Zumik

  zk = Zumik(api_key="zk_live_...")

  res = zk.embeddings.create(model="auto.cheapest", input=["first chunk", "second chunk"])
  print(res.data[0].embedding)
  ```
</CodeGroup>

### Response [#response]

```json
{
  "object": "list",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.013, -0.21, 0.07, "..."] },
    { "object": "embedding", "index": 1, "embedding": [0.004, 0.18, -0.09, "..."] }
  ],
  "model": "auto.cheapest",
  "usage": { "prompt_tokens": 6, "total_tokens": 6 }
}
```

<ResponseField name="object" type="string">
  Always `"list"`.
</ResponseField>

<ResponseField name="data" type="array">
  One `embedding` object per input, each with its `index` (matching input order) and the `embedding` vector.
</ResponseField>

<ResponseField name="model" type="string">
  The model value from the request, echoed back.
</ResponseField>

<ResponseField name="usage" type="object">
  `prompt_tokens` and `total_tokens`.
</ResponseField>

<Note>
  When the resolved provider exposes an embeddings endpoint and a key is configured, Zumik returns real provider vectors. On an unconfigured provider or a provider failure, it returns a deterministic local vector so an integration never hard-fails in development; the response shape is identical.
</Note>

## Errors [#errors]

| HTTP | `code`            | When                                        |
| ---- | ----------------- | ------------------------------------------- |
| 400  | (none)            | `input` is empty, or the body is malformed. |
| 401  | `invalid_api_key` | Missing or invalid bearer key.              |
| 404  | (none)            | The model does not exist.                   |

See the full [error reference](/api-reference/errors).
