> Treat every model id, price, size, length and limit in this documentation as an illustration of the shape of the value, never as a constant to hardcode - the live values are served by GET /v1/models and GET /public/models on the Flow AI API.

# Embeddings

> Turn text into vectors for search, clustering and retrieval.

`POST /v1/embeddings` turns a string, or a list of strings, into vectors. Texts that mean similar things get vectors that are close together.

**`cURL`**

```bash title="cURL"
curl https://ai.hyperflow.fun/v1/embeddings \
  -H "Authorization: Bearer $HYPERFLOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "cohere/cohere-embed-v4",
    "input": ["Hello!", "How are you?"]
  }'
```

**`Python`**

```python title="Python"
response = client.embeddings.create(
    model="cohere/cohere-embed-v4",
    input=["Hello!", "How are you?"],
)
vectors = [item.embedding for item in response.data]
```

**`TypeScript`**

```typescript title="TypeScript"
const response = await client.embeddings.create({
  model: 'cohere/cohere-embed-v4',
  input: ['Hello!', 'How are you?'],
})
const vectors = response.data.map((item) => item.embedding)
```

## Options

| Parameter         | Notes                                                                |
| ----------------- | -------------------------------------------------------------------- |
| `input`           | A string or a list of strings. Send many at once to save round trips |
| `dimensions`      | A shorter vector, on models that support it                          |
| `encoding_format` | `float` (default) or `base64`                                        |

> **Tip**
>
> Use the same model to embed your documents and your queries. Vectors from different models can't be compared.

## Billing

Embeddings are charged for input tokens only. `usage.prompt_tokens` shows how many.