Skip to main content

Authentication

Every request to the DhivehiGPT API is authenticated with an API key, sent as the X-Api-Key header. The SDK adds this header for you automatically once you've configured a client — see Installation & Setup.

Generating an API key​

API keys are generated from your DhivehiGPT team account, on the API Keys page.

To generate an API key you need:

  • A DhivehiGPT team account with an active subscription.
  • To be a team owner or team admin of that team — other team members cannot generate API keys.

Each API key belongs to a team, and any usage charged through it (such as generating TTS audio) draws from that team's credit balance — see Balance.

Keeping your API key secret​

Treat your API key like a password:

  • Prefer loading it from the DHIVEHIGPT_API_KEY environment variable rather than hardcoding it in source code.
  • Never commit API keys to version control.
  • Revoke and regenerate a key from the API Keys page if you believe it has been exposed.

Rate limits​

All API routes are rate limited to 60 requests per minute per API key. Exceeding this limit raises a dhivehigpt_sdk.RateLimitError — see Error Handling.