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

# Create an Embedding

Creates text embeddings.

```py Python theme={null}
from openai import OpenAI
import os

# 💥 Create an OpenAI client, pointed at Muna
openai = OpenAI(
  api_key=os.environ["MUNA_API_KEY"],
  base_url="https://inference.muna.ai/v1"
)

# 🔥 Create a text embedding
embedding = openai.embeddings.create(
  model="@nomic/nomic-embed-text-v1.5",
  input="What is the capital of France?"
)

# 🚀 Use the embedding
print(embedding.data[0].embedding)
```

```ts JavaScript theme={null}
import OpenAI from "openai"

// 💥 Create an OpenAI client, pointed at Muna
const openai = new OpenAI({
  apiKey: process.env.MUNA_API_KEY,
  baseURL: "https://inference.muna.ai/v1"
});

// 🔥 Create a text embedding
const embedding = await openai.embeddings.create({
  model: "@nomic/nomic-embed-text-v1.5",
  input: "What is the capital of France?"
});

// 🚀 Use the embedding
console.log(embedding.data[0].embedding);
```

```bash curl theme={null}
curl https://inference.muna.ai/v1/embeddings \
  -H "Authorization: Bearer $MUNA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "@nomic/nomic-embed-text-v1.5",
    "input": "What is the capital of France?"
  }'
```

```json Response theme={null}
{
  "object": "list",
  "model": "@nomic/nomic-embed-text-v1.5",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0123, -0.0456, 0.0789]
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}
```

### Body

**model** `string` *required*

Model tag.

**input** `string | string[]` *required*

Input text to embed. Pass a list of texts to embed them in a single request.

**dimensions** `integer`

Number of embedding dimensions, for models that support Matryoshka representation learning.

**encoding\_format** `string`

Embedding encoding format: `float` or `base64`. Defaults to `float`.

### Response

**object** `string` *required*

Object type, always `list`.

**model** `string` *required*

Model tag.

**data** `Embedding[]` *required*

Embeddings, one for each input text.

**properties**

**object** `string` *required*

Object type, always `embedding`.

**index** `integer` *required*

Index of the input text.

**embedding** `number[] | string` *required*

Embedding vector, or a base64 string when `encoding_format` is `base64`.

**usage** `Usage` *required*

Token usage.

**properties**

**prompt\_tokens** `integer` *required*

Number of tokens in the input.

**total\_tokens** `integer` *required*

Total number of tokens.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.