> ## 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.

# Output Formats

> Choose between JSON float vectors and base64-encoded embeddings.

NagaAI supports two embedding output encodings:

* `float` for directly usable JSON arrays
* `base64` for more compact transport or custom binary decoding workflows

Use `float` unless you have a specific reason to optimize transport size or handle your own decoding path.

## Format comparison

| Format   | Best for                                                              |
| -------- | --------------------------------------------------------------------- |
| `float`  | direct use in application code, quick debugging, JSON-first workflows |
| `base64` | lower payload size, custom binary pipelines, delayed decoding         |

## Float 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="hello world",
      encoding_format="float",
  )

  print(type(response.data[0].embedding))
  ```

  ```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: 'hello world',
    encoding_format: 'float',
  });

  console.log(Array.isArray(response.data[0].embedding));
  ```

  ```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": "hello world",
      "encoding_format": "float"
    }'
  ```
</CodeGroup>

## Base64 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="hello world",
      encoding_format="base64",
  )

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

  ```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: 'hello world',
    encoding_format: 'base64',
  });

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

  ```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": "hello world",
      "encoding_format": "base64"
    }'
  ```
</CodeGroup>

## Related Docs

* [Embeddings API](/api/embeddings)
* [Batch Inputs](/api/embeddings/batch-inputs)
