Skip to content

API Keys

How to generate, manage, and authenticate with Fusion AI Gateway API keys.

Updated View as Markdown

API Keys & Authentication

Fusion AI Gateway uses API keys starting with fc_ to authenticate requests to /v1/chat/completions, /v1/models, /v1/usage, and edge gateway routes.


1. How to Obtain an API Key

There are two primary ways to obtain a Fusion API key:

If you use the fusion command-line tool, running fusion login automatically generates a dedicated CLI API key and saves it to your local config file.

  1. Open your terminal and run:
    fusion login
  2. Your default browser will open automatically (or visit the URL shown in terminal): https://fusioncode.app/cli-auth?token=...
  3. Sign in with your Google or Email account and click Authorize CLI Session.
  4. The CLI retrieves your new API key (fc_...) and saves it to ~/.fusion/config.toml:
    [providers.fusion]
    api_key = "fc_1a2b3c4d5e6f7g8h9i0j..."

Method B: Fusion Web Dashboard

You can generate, view, and revoke API keys anytime from the web dashboard:

  1. Go to https://fusioncode.app/dashboard.
  2. Sign in to your account.
  3. Navigate to API Keys in the navigation menu.
  4. Click Create New Secret Key.
  5. Give your key a descriptive name (e.g., OpenCode Laptop, CI Gateway) and copy the full key (fc_...).

[!WARNING] Secret keys are only shown once upon creation. Store your key securely in an environment variable or secret manager.


2. Using Your API Key

Pass your API key in standard HTTP headers when making requests to https://api.fusioncode.app:

Option A: Authorization Header (Standard Bearer Format)

Authorization: Bearer fc_your_api_key_here

Option B: Custom Header (x-api-key)

x-api-key: fc_your_api_key_here

3. Verifying Your Key

Test that your API key is valid using the /gateway/test diagnostic endpoint:

curl -X GET https://api.fusioncode.app/gateway/test \
  -H "Authorization: Bearer fc_your_api_key_here"

Response:

{
  "success": true,
  "message": "API key is valid!",
  "key": {
    "id": "key_12345",
    "name": "CLI Key"
  }
}

4. Quotas & Usage Monitoring

Every Fusion account includes a monthly token quota:

  • Starter Plan: 1,000,000 tokens / month
  • Pro Plan: 5,000,000 tokens / month (plus bonus credits from redeemed coupons)

Check your monthly usage and remaining balance using the /v1/usage endpoint:

curl -X GET https://api.fusioncode.app/v1/usage \
  -H "Authorization: Bearer fc_your_api_key_here"

Response:

{
  "user_email": "user@example.com",
  "used_tokens_this_month": 142500,
  "quota_tokens": 1000000,
  "remaining_tokens": 857500
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close