Getting Started
What is API?
API is an AI model aggregation and relay platform. Built to be compatible with OpenAI's API format, it allows you to invoke models across multiple providers (Chat, Image, Video, Audio, etc.) using a single unified Base URL and API key.
Key Integration Elements
| Item | Description |
|---|---|
| Base URL | https://4zapi.com/v1 (OpenAI-compatible path) |
| API Key | Generated under "API Tokens" in the console; pass via request header Authorization: Bearer sk-xxx |
| Model | Check "Supported Models" in the console or call GET /v1/models |
Model requests use the API Key listed above. Account management endpoints require the System Access Token described in the next section.
System Access Token
System Access Tokens are used to call account management endpoints (e.g., retrieving the current account profile). To generate one while logged into the console:
- Click Profile on the left menu, then select Profile Settings.
- Switch to the Account & Security tab.
- Under API Call Tokens, locate System Access Token and click Generate Token.
Once generated, the new token is automatically copied to your clipboard and displayed on the card (masked by default). Click the eye icon to reveal the full key, or the copy icon to copy it again. The ID: at the top of the page represents your User ID; click to copy it.
Clicking Generate Token immediately invalidates the previous token and issues a new one. The token will not be displayed in plain text after refreshing the page; you will need to regenerate it to view the plain text again.
When calling management endpoints, include both of the following request headers:
| Header | Value |
|---|---|
Authorization |
Bearer <System Access Token> (Bearer prefix can be omitted) |
New-Api-User |
User ID shown at the top of the Profile Settings page (must match the account owning the token) |
Recommended Learning Path
- 5-Minute Quick Start (Python)
- General Guide to Asynchronous Tasks (Must-read for Video, Suno, Kling, etc.)
- Platform-specific OpenAPI references under API Reference in the portal
Relationship with Official APIs
- Default: Change
base_urlto point to , and set the model name to a -supported ID. - Advanced: Certain platforms support native route paths (e.g.,
/kling/*,/suno/*); refer to each platform's documentation in the portal.
Common Errors
| Symptom | Probable Cause |
|---|---|
invalid character '<' looking for beginning of value |
Incorrect Base URL or path; upstream returned an HTML page. |
| 401 | Invalid or disabled API key. |
| Management endpoint returns 401 | Missing New-Api-User header, User ID mismatch with the token owner, or token invalidated by regenerating a new one. |
401 when requesting /v1 using a System Access Token |
Model endpoints require the sk-xxx API key generated under "API Tokens". |
| Model does not exist | Typo in the model name, or the current user group lacks permission. |
For further troubleshooting, check the x-error-playbook section in each platform's OpenAPI specification.