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

# Regions

> Choose between the canonical geo-routed KugelAudio endpoint and the direct EU endpoint for data residency, and set the region by API key prefix or in code.

By default, SDKs use the canonical geo-routed endpoint. Select the direct EU
endpoint only when you need to pin traffic to Europe.

<Tip>
  Need your data to stay on your own infrastructure? See
  [On-Premise Deployment](/guides/self-hosted) (Enterprise).
</Tip>

## Endpoint Options

| Selection | Endpoint | Behavior |
|-----------|----------|----------|
| Default | `api.elbic.com` | Canonical geo-routed API |
| `eu` | `api.eu.elbic.com` | Direct EU endpoint |
| API URL `https://api.us.elbic.com` | `api.us.elbic.com` | Direct US endpoint; pin US traffic by setting the API URL |
| `us` / `global` | `api.elbic.com` | Supported compatibility hints: `region="us"` routes to the canonical endpoint, not the US host |

<Note>
  The default endpoint can answer from outside the EU. If your organization is
  on the EU-Only Hosting data processing agreement, send every request to
  `api.eu.elbic.com`: set `region="eu"` in an SDK or call the EU host
  directly.
</Note>

## How to Set Your Region

The SDKs select the direct EU endpoint from an API-key prefix or an explicit
region. You can also bypass region resolution by supplying an API URL directly.
Without an SDK, call the EU host yourself.

### Option 1: Prefix Your API Key (SDKs only)

Prepend `eu-` to your API key. The SDK strips the prefix before sending the key
and routes the request to the EU endpoint:

```bash
# .env
KUGELAUDIO_API_KEY=eu-YOUR_API_KEY
```

No code changes needed. The prefix is an SDK feature: the API itself does not
recognize it, so a raw HTTP or WebSocket request with a prefixed key fails with
`401 Invalid API key`.

### Option 2: Set the Region in Code

All SDKs accept an explicit EU region parameter:

<Tabs>
  <Tab title="Python">
    ```python
    from kugelaudio import KugelAudio

    client = KugelAudio(api_key="YOUR_API_KEY", region="eu")
    ```

    With the async client:

    ```python
    import asyncio
    from kugelaudio import KugelAudio

    async def main():
        client = await KugelAudio.create(api_key="YOUR_API_KEY", region="eu")
        await client.aclose()

    asyncio.run(main())
    ```
  </Tab>
  <Tab title="JavaScript">
    ```typescript
    import { KugelAudio } from 'kugelaudio';

    const client = new KugelAudio({
      apiKey: 'YOUR_API_KEY',
      region: 'eu',
    });
    ```
  </Tab>
  <Tab title="Java">
    ```java
    import com.kugelaudio.sdk.*;

    KugelAudio client = new KugelAudio(
        KugelAudioOptions.builder("YOUR_API_KEY")
            .region(Region.EU)
            .build()
    );
    ```
  </Tab>
  <Tab title="cURL">
    Call the EU host directly, with the key **without** the `eu-` prefix:

    ```bash
    curl -X POST https://api.eu.elbic.com/v1/tts/generate \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"text": "Hello from KugelAudio!", "model_id": "kugel-3.5", "voice_id": 1071}'
    ```
  </Tab>
</Tabs>

### Priority

When multiple EU endpoint hints are present, the SDK resolves them in this order:

1. **Explicit API URL:** `api_url` in Python, `apiUrl` in JavaScript, or `apiUrl` in Java
2. **`region`:** explicit EU region parameter
3. **API key prefix:** `eu-`
4. **Default:** canonical geo-routed API (`api.elbic.com`)

## WebSocket Connections

EU endpoint selection applies to both REST and WebSocket endpoints. The SDK
automatically uses the correct host for WebSocket connections. Raw WebSocket
clients connect to the EU host and send the unprefixed key in a header:

```bash
wscat -c "wss://api.eu.elbic.com/ws/tts" -H "Authorization: Bearer YOUR_API_KEY"
```

## FAQ

<AccordionGroup>
  <Accordion title="Do I need to change anything if I use the default endpoint?">
    If you want automatic geo-routing, no. If you need to pin traffic to Europe, set `region="eu"` or the `eu-` key prefix in an SDK, or call `api.eu.elbic.com` directly.
  </Accordion>

  <Accordion title="Are voices and models the same across regions?">
    Yes for models: `api.elbic.com` and `api.eu.elbic.com` both serve
    `kugel-3` and `kugel-3.5`, with the same default model and the same
    [legacy](/models#legacy-model-ids) and
    [ElevenLabs](/integrations/elevenlabs-proxy#available-models) ID mapping.
    An [on-premise deployment](/guides/self-hosted) serves only the models it
    was installed with. Query `/v1/models` and `/v1/voices` on the endpoint you
    plan to use to confirm its catalog and your custom-voice availability:

    ```bash
    curl https://api.eu.elbic.com/v1/models \
      -H "Authorization: Bearer $KUGELAUDIO_API_KEY"
    ```
  </Accordion>

  <Accordion title="Can I switch regions without getting a new API key?">
    Yes. Your API key works with the default and EU endpoints. In an SDK, add or remove the `eu-` prefix or the `region="eu"` parameter; without an SDK, change the host. No need to regenerate keys.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/api-reference/authentication">
    Create and use API keys
  </Card>
  <Card title="On-Premise Deployment" icon="server" href="/guides/self-hosted">
    Run KugelAudio on your own infrastructure
  </Card>
</CardGroup>
