OpenAI API key: create, fund, and fix errors
If OpenAI replies fail, the cause is usually billing, key mismatch, or model access. This checklist resolves the common setup failures quickly.
1
Create API key
- Open your OpenAI account dashboard and create a new API key.
- Copy it once and store in your password manager.
- Add it to your agent as
OPENAI_API_KEY.
2
Enable billing and limits
Add a valid payment method, confirm your usage limits, and wait a few minutes for account updates to propagate.
3
Fix common errors
- insufficient_quota: add funds or increase limits.
- 401 unauthorized: invalid or wrong key in environment.
- model not found: use a model your account can access.