Newapi uses API tokens (Bearer tokens) to authenticate all requests. You create tokens in the console and include them in theDocumentation Index
Fetch the complete documentation index at: https://doc.hitopen.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorization header of every API call.
Getting your API token
Create a token
Click New Token. Configure the following options:
| Field | Description |
|---|---|
| Name | A label to identify this token (e.g., “My App”, “Production”) |
| Quota | Optional maximum credit limit for this token |
| Expiry | Optional expiration date; leave blank for no expiry |
| Models | Optional allowlist of models this token can access |
Using your token in requests
Include your token in theAuthorization header of every request:
Example: Chat completion
Using with the OpenAI SDK
The OpenAI Python and JavaScript SDKs work directly with Newapi. Pass your token asapi_key and your Newapi URL as base_url:
Management API authentication
The Management API (for token management, channel configuration, etc.) uses a different authentication mechanism. You have two options:- Access Token (recommended)
Generate a system access token from Personal Settings → Security Settings → System Access Tokens in the console, then pass it as a Bearer token:
Required header for some endpoints
Some management endpoints require you to identify the acting user:user_id must match your currently authenticated account.
Permission levels
Management API endpoints have different permission requirements:| Level | Description |
|---|---|
| Public | No authentication required |
| User | Requires a valid API token or session |
| Admin | Requires administrator privileges |
| Root | Highest privilege level |
For AI Model API calls (
/v1/chat/completions, /v1/images/generations, etc.), always use your sk- token created in Token Management — not a system access token.Common authentication errors
| Error | Cause | Fix |
|---|---|---|
401 Unauthorized | Missing or invalid token | Check your Authorization header |
403 Forbidden | Token lacks required permissions | Ensure your token has the needed quota or model access |
429 Too Many Requests | Rate limit or quota exceeded | Check your token’s quota in Token Management |