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

# Configure API keys and routing groups

> Configure Floodgate API keys with routing groups, fallback order, smart routing, model restrictions, and spending limits in USD.

Each Floodgate API key has its own routing settings and spending limit. Configure these in [API Keys](https://floodgate.dev/keys). All keys spend from the same account balance.

## Set up a key

1. Create or edit a key.
2. Select routing groups in priority order, or choose smart routing.
3. Set a spending limit in USD or choose unlimited.
4. Add any model restrictions or expiry date, then save.

You can keep your existing key. If it returns HTTP 409 with `api_key_setup_required`, complete these settings before sending another request. This error does not charge your balance.

```json theme={null}
{
  "error": {
    "message": "Select a primary group and optional fallbacks in API Keys before using this key. No funds were charged.",
    "type": "setup_required",
    "code": "api_key_setup_required",
    "setup_url": "/keys"
  }
}
```

An unlimited key can spend the available account balance. Your account's rate and concurrency limits still apply.

## Routing groups and fallbacks

A routing group offers a selection of models at its own prices. The first group in your key's list is the primary group. The remaining groups are fallbacks.

Drag groups or use the reorder controls to change their priority. The selector shows how many groups you can choose.

Choose groups that support your model and API. When a fallback handles a request, its price applies. Compare prices in [Model Square](https://floodgate.dev/models) before adding fallbacks.

Group names are case-sensitive. `Standard` is the current name of the former `Economy` group. Names such as `Codex-Gpt-1` and `Claude-Code-1` identify routing groups. Use the separate [client guides](https://docs.floodgate.dev/agents/overview.md) to configure your coding tool.

## Smart routing

Smart routing chooses a group for each request based on your preference.

| Preference | API value | How it chooses |
| - | - | - |
| Balanced | `balanced` | Considers price, recent reliability, and time to first token |
| Price first | `price_first` | Prefers a lower listed price for comparable usage |
| Stability first | `stability_first` | Prefers groups with recent successful requests for the model |
| Faster responses | `fastest` | Prefers a shorter measured time to first token |

Smart routing uses groups that support the requested model and API. It follows your key's model restrictions and spending limit.

Your manual group order is kept when you switch to smart routing. You can switch back at any time. An empty `smart_routing` value uses the saved `auto_groups` order.

The final charge depends on actual usage, including output length, cached tokens, context pricing, media settings, and minimum charges. Choose groups manually if you want to control which groups can handle your requests.

## Manage routing through the API

`GET /api/token/auto-groups` returns the routing groups, `max_count`, and `quota_per_usd`. Use account authentication for this endpoint.

When creating or updating a key, use `auto_groups` for manual routing or `smart_routing` for a routing preference. Use the dashboard to set a spending limit in USD.

## Group prices

A display ratio compares a group's price with a reference API price. For example, 0.5x means 50% of the reference price. Model-specific prices, context tiers, and minimum charges determine the final bill.

| Group | Display ratio |
| - | - |
| `AWS-Bedrock-1` | 0.4941216x |
| `AWS-Bedrock-2` | 0.6588288x |
| `AWS-Claude-1` | 0.4941216x |
| `AWS-Claude-2` | 0.9882432x |
| `AWS-Claude-3` | 1.232x |
| `Aistudio-Gemini-1` | 0.1976464x |
| `Aistudio-Gemini-2` | 0.2964752x |
| `Aistudio-Gemini-3` | 0.4941216x |
| `Aistudio-Gemini-4` | 1.0705968x |
| `Alibaba-1` | 0.560x |
| `Alibaba-2` | 0.8400x |
| `Alibaba-3` | 1.232x |
| `Alibaba-image-1` | 0.7280x |
| `Alibaba-image-2` | 0.896x |
| `Anthropic-Claude-1` | 1.232x |
| `Anti-Gemini-1` | 0.0823536x |
| `Azure-Gpt-1` | 0.04928x |
| `Azure-Gpt-2` | 0.112x |
| `Azure-Gpt-3` | 0.2464x |
| `Azure-Gpt-4` | 0.4928x |
| `Azure-Gpt-5` | 0.672x |
| `Azure-Gpt-6` | 1.008x |
| `Azure-Grok-1` | 0.0823536x |
| `Azure-Grok-2` | 0.123536x |
| `Claude-Code-1` | 0.1976464x |
| `Claude-Code-2` | 0.3294144x |
| `Cli-Gemini-1` | 0.0823536x |
| `Cli-Grok-1` | 0.0823536x |
| `Cli-Grok-2` | 0.1153040x |
| `Codex-Gpt-1` | 0.0411824x |
| `Codex-Gpt-2` | 0.0658896x |
| `Codex-Gpt-3` | 0.0823536x |
| `Discounted-Banana-1` | 0.0823536x |
| `Discounted-Banana-2` | 0.1153040x |
| `Discounted-Gemini-2` | 0.1608432x |
| `Doubao-1` | 0.560x |
| `Doubao-2` | 0.8400x |
| `Doubao-3` | 1.232x |
| `Gpt-Image-1` | 0.0823536x |
| `Gpt-Image-2` | 0.1029504x |
| `Gpt-Image-3` | 0.1544144x |
| `Hailuo-3` | 1.232x |
| `Kimi-1` | 0.8400x |
| `Kimi-2` | 1.232x |
| `Kiro-Claude-1` | 0.0988288x |
| `Openai-Gpt-1` | 0.6588288x |
| `Openai-Gpt-2` | 0.823536x |
| `Self-Deployed-1` | 0.336x |
| `Self-Deployed-2` | 0.560x |
| `Self-Deployed-3` | 0.8400x |
| `Standard` | Model-specific |
| `Vertex-Gemini-1` | 0.224x |
| `Vertex-Gemini-2` | 0.336x |
| `Vertex-Gemini-3` | 1.008x |
| `Xai-Grok-1` | 0.4941216x |
| `Xiaomi-1` | 0.8400x |
| `Xiaomi-2` | 1.232x |
| `deepseek-1` | 1.232x |
| `glm-1` | 1.232x |
| `hunyuan-1` | 1.0640x |

Use [Model Square](https://floodgate.dev/models) for the full selection of groups and model prices. Account tiers control discounts and limits separately from routing groups. See [Billing and tiers](https://docs.floodgate.dev/billing.md).


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