> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kymaapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create embeddings

> Turn text into vectors for retrieval. OpenAI-compatible.

## Switching from OpenAI

Change the base URL and the model id. Nothing else.

```python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="ky-...",
    base_url="https://api.kymaapi.com/v1",
)

vectors = client.embeddings.create(
    model="embeddinggemma-300m",
    input=["first document", "second document"],
)
```

## Which model

| Model                 | Input / 1M | Dimensions |  Input limit  |
| --------------------- | :--------: | :--------: | :-----------: |
| `embeddinggemma-300m` |  \$0.0027  |     768    |  2,048 tokens |
| `qwen3-embedding-8b`  |  \$0.0135  |    4096    | 32,768 tokens |

Start with `embeddinggemma-300m`. It is the cheaper of the two by 5×, and 768 dimensions is enough for most retrieval — smaller vectors are also cheaper to store and faster to search.

Reach for `qwen3-embedding-8b` when recall quality matters more than cost, when your corpus is multilingual, or when documents are long enough that a 2,048-token window would force you to chunk them.

<Note>
  Embedding and chat models are not interchangeable. Passing a chat model here returns `400` naming the mistake rather than a vector you cannot use.
</Note>

## Billing

Input tokens only. A vector has no completion side, so `usage` carries `prompt_tokens`, `total_tokens` and `cost` — and `cost` is the exact USD charged for that call.

```json theme={null}
"usage": { "prompt_tokens": 14, "total_tokens": 14, "cost": 0.00000004 }
```

## Batching

Pass an array to `input` and you get one vector per element, in the same order. One request with 100 documents costs the same as 100 requests with one document each and is considerably faster — batch as large as your payload allows, up to 25 MB.

Responses are not streamed: a vector arrives whole.
