Fireworks AI API keys are created in the Fireworks dashboard at app.fireworks.ai/settings/users/api-keys with Create API key, or with firectl api-key create. The key value is shown only at creation and is sent as Authorization: Bearer $FIREWORKS_API_KEY. For CI and backend services, Fireworks offers service accounts whose API keys only an Admin can create.
Fireworks AI key types
| Type | Prefix | Secret? | Scope | Expiry |
|---|---|---|---|---|
| User API key Every role can create and delete its own API keys. | — | Yes | Acts as the user who created it, with that user's role (Admin, User, Contributor or Inference user) in the account | Keys made with `firectl api-key create` expire one year after creation unless `--expire-time` sets an earlier date (at most 365 days) |
| Service account API key Only Admins can create or delete service account API keys. Service accounts cannot sign in to the web interface and appear in audit logs as name@account.sa.fireworks.ai. | — | Yes | Acts as a non-human service account with the role assigned to it (default `user`) | Same `firectl` expiry rules as user keys |
How to create a Fireworks AI key
- Sign in to the Fireworks dashboard.
- Open
app.fireworks.ai/settings/users/api-keysand click Create API key. - Copy the key immediately. Fireworks does not store the key value after creation.
- Or run
firectl api-key create --key-name "Production Key"; an Admin can add--service-account <name>to create a key for a service account. - Set
FIREWORKS_API_KEYin the environment or secrets manager that runs your code.
Open Fireworks AI's key settings
Limiting what the key can do
Fireworks AI API keys carry the role of the user or service account they belong to. Give automation its own service account with the narrowest role, such as Inference user, which can run inference but cannot create or modify resources. Set a short --expire-time on keys made with firectl. Usage is billed at the account level, not per key.
How to rotate a Fireworks AI key
- Create a new key with
firectl api-key create(optionally with--expire-time) or in the dashboard. - Deploy it wherever
FIREWORKS_API_KEYis read and confirm requests succeed. - Delete the old key with
firectl api-key delete <key-id>.
The old and new Fireworks AI API keys both work until the old one is deleted or expires.
How to revoke a Fireworks AI key
- Run
firectl api-key delete <key-id>. - Or call
POST /v1/accounts/{account_id}/users/{user_id}/apiKeys:delete(Delete API Key) with the key ID, which the List API Keys endpoint returns. - Users can delete their own keys; only Admins can delete other users' and service accounts' keys.
If your Fireworks AI key leaked
- Delete the exposed Fireworks AI API key with
firectl api-key delete <key-id>or the Delete API Key endpoint. - Create a replacement, ideally on a service account with a narrow role, and deploy it.
- Review the account's audit logs and usage for activity you do not recognise.
- Update every service and CI secret that used the old key.
Environment variables and CLI
Fireworks AI's SDKs and docs read the key from FIREWORKS_API_KEY.
firectl (firectl): firectl signin signs in to your Fireworks account; firectl whoami shows the current account. The --api-key flag or a profile in ~/.fireworks/auth.ini can also supply credentials.
Things that catch people out
- Keys made with
firectlexpire after one year by default, so long-running services need a rotation plan. - Fireworks shows the key value only once and does not store it.
- Fireworks AI API keys are not in GitHub secret scanning's supported patterns, so a leaked key in a repository will not raise a GitHub alert.
Common Fireworks AI authentication errors
Unauthorized
HTTP 401. Fireworks lists an invalid API key or insufficient permissions as the likely causes.
Using your Fireworks AI key with AI agents
A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.
BotPassword works this way. For a Fireworks AI key, these intents fit:
| Intent | What BotPassword does |
|---|---|
run_with | Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output. |
http_request | Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused. |
cli_login | Lets git, Docker, the AWS CLI and kubectl log in through bpw's credential helper, so the token is fetched when the tool needs it and not written into its config. The helper hands the value to the tool, so the grant is always disclosing. Other tools use run_with; OAuth device logins are planned. |
store_secret | Saves a value the agent already holds as a new vault item. |
capture_secret | Planned, not built yet: will read a newly created key straight from the page or command output into the vault. |
Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents
Frequently asked questions
Where do I create a Fireworks AI API key?
Click Create API key at app.fireworks.ai/settings/users/api-keys, or run firectl api-key create.
What environment variable does Fireworks use?
FIREWORKS_API_KEY.
Do Fireworks AI API keys expire?
Keys created with firectl api-key create expire one year after creation by default, and --expire-time can set an earlier date within 365 days.
How do I delete a Fireworks AI API key?
Run firectl api-key delete <key-id>, or call the REST API's Delete API Key endpoint with the key ID.
Should I use a service account for production?
Fireworks service accounts exist for CI/CD pipelines, backend services and automated workflows, so production code does not depend on a person's key. Only an Admin can create their keys.
Can an AI agent use my Fireworks AI key without seeing it?
Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a .env file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with run_with, http_request, store_secret, so the agent gets the result and never the value.