NgamiaNgamiaDocs

Get started

Authentication

Use a JWT for account management and an ngm_ API key for model requests. Keep the two credentials separate.

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…UseWhy
Registering, logging in, or refreshing a sessionNo bearer credential, or the relevant refresh tokenThese endpoints create or rotate sessions.
Reading your profile or workspacesJWT access tokenThese are account-management operations.
Creating, listing, renaming, or revoking API keysJWT access tokenKey management belongs to the authenticated account.
Listing models or sending chat, embedding, transcription, speech, or voice requestsngm_... API keyThis is the server-to-server gateway credential.
Reading balanceAPI key or JWTBoth credentials can read the current balance.
Reading activity, payments, notifications, or transactionsJWT access tokenThese 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

GET/v1/modelsAPI key
curl 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.