API-Key Management

Q: How do I obtain an API Key?

A: Log in to the console → "API keys" → "Create API Key" → Enter key name → Click create.

Q: What should I do if my API Key is lost or leaked?

A: Please perform the following actions immediately:

  1. Log in to the console → "API Key Management"

  2. Locate the corresponding Key → Click "Disable" or "Delete"

  3. Click "Create API Key" to generate a new Key

  4. Update the Key configuration in your project

Recommendation: Do not hardcode Keys in your code. It is recommended to manage them using environment variables

(such as export OPENAI_API_KEY=sk-xxx).

Q: Can I create multiple API Keys?

A: Yes. Each account can create multiple API Keys. It is recommended to create them separately by project/environment, for example:

  • prod-key: Production environment

  • dev-key: Development and testing

  • team-a-key: Dedicated for Team A

This facilitates separate usage tracking and quota management, and ensures that if a Key is compromised, other business operations remain unaffected.

Q: How do I set usage limits for an API Key?

A: Console → "API Key Management" → Select the corresponding Key → "Quota Settings":

  • Configurable options: Daily credit limit / Monthly credit limit / Total available quota

  • Requests from this Key will return a 429 error once the limit is reached

  • The master account is not restricted by sub-Key limits

Q: Do API Keys have an expiration date?

A: By default, API Keys are valid indefinitely and will not expire automatically. However, the following situations will cause a Key to become invalid:

  • Manually disabled or deleted

  • Account suspended (arrears / policy violations)

  • Account balance exhausted

It is recommended to rotate Keys regularly (e.g., quarterly) to enhance security.