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

# Embeddings

> Create text embeddings through the OpenAI-compatible AI Gateway route.

`POST /v1/embeddings` converts one string or a batch of strings into vectors. Use it for semantic search, retrieval, clustering, recommendations, and similarity comparisons.

## Create an Embedding

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import OpenAI from "openai";

    const client = new OpenAI({
      baseURL: "https://api.inquantum.ai/v1",
      apiKey: process.env.PLANCK_API_KEY,
    });

    const response = await client.embeddings.create({
      model: "text-embedding-3-small",
      input: ["first document", "second document"],
    });

    console.log(response.data[0].embedding);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    from openai import OpenAI

    client = OpenAI(
        base_url="https://api.inquantum.ai/v1",
        api_key=os.environ["PLANCK_API_KEY"],
    )

    response = client.embeddings.create(
        model="text-embedding-3-small",
        input=["first document", "second document"],
    )

    print(response.data[0].embedding)
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.inquantum.ai/v1/embeddings \
      -H "Authorization: Bearer $PLANCK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "text-embedding-3-small",
        "input": ["first document", "second document"]
      }'
    ```
  </Tab>
</Tabs>

The response follows the OpenAI embeddings shape with an ordered `data` array and input-token usage.

## Choosing a Model

Use a model that advertises the `embeddings` operation and copy its model ID from the model registry. The Planck endpoint, authentication, and response shape stay the same regardless of the selected model.

<Note>
  Anthropic does not expose an embeddings API. The Anthropic-compatible Messages
  route is for text generation, not embeddings.
</Note>

## Billing and Tracking

Embedding requests are recorded in **Requests** with the selected provider, model, input tokens, duration, cost, request body, and response body. If you send the optional `user` field, it is used as the request's user attribution.

See the [Embeddings API reference](/rest/ai-gateway/post-v1-embeddings) for request and response fields.
