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

# Batch Inputs

> Send multiple embedding inputs in one request and interpret the indexed results.

The `input` field can be a single string or an array of inputs.

Batching is useful when you are indexing many chunks and want to reduce request overhead.

## Batch Example

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.naga.ac/v1",
      api_key="YOUR_API_KEY",
  )

  response = client.embeddings.create(
      model="text-embedding-3-small",
      input=["semantic search", "vector database", "hybrid retrieval"],
  )

  print(response.data[0].index)
  ```

  ```javascript Node.js theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: 'https://api.naga.ac/v1',
    apiKey: 'YOUR_API_KEY',
  });

  const response = await client.embeddings.create({
    model: 'text-embedding-3-small',
    input: ['semantic search', 'vector database', 'hybrid retrieval'],
  });

  console.log(response.data[0].index);
  ```

  ```bash cURL theme={null}
  curl https://api.naga.ac/v1/embeddings \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "text-embedding-3-small",
      "input": [
        "semantic search",
        "vector database",
        "hybrid retrieval"
      ]
    }'
  ```
</CodeGroup>

The response returns one embedding per input with an `index` field, so you can map results back to the original batch order.

## How to read the result

* `data[0]` is the embedding for the first input
* `data[1]` is the embedding for the second input
* the `index` field lets you map embeddings back to the original batch even if you do additional processing later

## When To Batch

* indexing many documents or chunks
* reducing per-request overhead
* building offline retrieval corpora

## Common mistakes

* batching inputs from different workflows when you need separate metadata
* assuming the response order can be inferred without using `index`
* sending a giant batch without thinking about request size, retries, and indexing checkpoints

## Reference

* [Create embeddings](/api-reference/endpoints/embeddings/create)
