Ngamia has two credential types. Choose the credential based on the resource you are calling, not on where the request originates.
Choose the right credential
| If you are… | Use | Why |
|---|---|---|
| Registering, logging in, or refreshing a session | No bearer credential, or the relevant refresh token | These endpoints create or rotate sessions. |
| Reading your profile or workspaces | JWT access token | These are account-management operations. |
| Creating, listing, renaming, or revoking API keys | JWT access token | Key management belongs to the authenticated account. |
| Listing models or sending chat, embedding, transcription, speech, or voice requests | ngm_... API key | This is the server-to-server gateway credential. |
| Reading balance | API key or JWT | Both credentials can read the current balance. |
| Reading activity, payments, notifications, or transactions | JWT access token | These endpoints expose account history and settings. |
Every authenticated request uses the same header format:
Authorization: Bearer <token>JWT access token
A JWT represents a logged-in human session. Use it for profile, workspace, API-key management, billing history, activity, notification settings, and other account operations.
Access tokens last 15 minutes. When one expires, call POST /v1/auth/refresh with the refresh token. Refresh tokens last 30 days and rotate after a successful refresh. See Register, login & sessions for the complete session flow.
Do not use a JWT as the long-lived credential in a gateway integration. JWTs expire and are intended for account sessions, not application-to-model traffic.
API key
An API key starts with ngm_.... Create it with a JWT on the API keys page, then use it for GET /v1/models, chat, embeddings, transcription, speech, and combined voice requests.
API keys have the gateway:use scope. They cannot manage other keys, read activity, or change account settings. Store them in a server-side secret manager or environment variable. Never place one in browser JavaScript, a mobile bundle, a public repository, or a client-side log.
Prefer an API key for production gateway calls. Keep it on your server and use your JWT for account, payment, workspace, and activity operations. Gateway routes accept the credential types shown in the full API reference.
Call the gateway
/v1/modelsAPI keycurl https://api.ngamia.cc/v1/models \\
-H "Authorization: Bearer $NGAMIA_API_KEY"For chat requests, use the same API key and the base_url ending in /v1. See Chat completions for the full request contract.