1. Preparation
1.1 Prepare the Three Required Parameters
| Base URL | https://api.maitoken.com/v1 |
|---|---|
| Full Chat Request URL | https://api.maitoken.com/v1/chat/completions |
| Responses Request URL | https://api.maitoken.com/v1/responses (Used by Codex) |
| Anthropic Request URL | https://api.maitoken.com/v1/messages (Used by Claude Code) |
| API Key | Create one in the MaiToken user console. The placeholder used in this guide is <your MaiToken Key>. |
| Model ID | Copy it from the expanded model list associated with the API Key or from the response returned by GET /v1/models. |
1.2 Create an API Key and Find the Model ID
Log in to the console: Open the MaiToken user console and sign in to your account.
Open API Keys: Find API Keys in the left-hand menu.
Create or edit a Key: Click “Create API Key,” or edit an existing API Key. After creating a Key, copy it immediately and store it securely.
View the expanded model list: Find “API Key Group” on the creation or editing page. The strings displayed in the expanded list under the group are the model IDs available to that API Key.
Copy the Model ID: Copy the complete ID, including its capitalization, hyphens, and version number. Do not copy the model's localized display name.
Model ID example: If the platform displays model.id as abc-model-2026, enter abc-model-2026 in the configuration field. Do not enter a model family name such as “GPT” or “Claude.” |
|---|
1.3 Choosing Between a Base URL and a Full URL
| Field Name | Enter | Do Not Enter |
|---|---|---|
| Base URL / API Host / API Address | https://api.maitoken.com/v1 | Do not append /chat/completions. |
| Full URL / Request URL / Endpoint URL | https://api.maitoken.com/v1/chat/completions | Do not stop at /v1. |
Quick rule: If the field contains Base, Host, or API Address, enter the URL ending in /v1. If the field contains Full URL, Request URL, or Endpoint URL, enter the URL ending in /v1/chat/completions. |
|---|
2. Test the API First
If the API test fails, do not configure the client yet. Replace the API Key and Model ID in the following commands with your actual values.
2.1 macOS / Linux
export MAITOKEN_API_KEY="<your MaiToken Key>"export MAITOKEN_MODEL="<Model ID>" curl -sS https://api.maitoken.com/v1/models \ -H "Authorization: Bearer $MAITOKEN_API_KEY"curl -sS https://api.maitoken.com/v1/chat/completions \ -H "Authorization: Bearer $MAITOKEN_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"'"$MAITOKEN_MODEL"'","messages":[{"role":"user","content":"Reply with OK only"}],"stream":false}'2.2 Windows PowerShell
$env:MAITOKEN_API_KEY="<your MaiToken Key>"$env:MAITOKEN_MODEL="<Model ID>" Invoke-RestMethod https://api.maitoken.com/v1/models ` -Headers @{Authorization="Bearer $env:MAITOKEN_API_KEY"}$body = @{ model = $env:MAITOKEN_MODEL messages = @(@{role="user"; content="Reply with OK only"}) stream = $false} | ConvertTo-Json -Depth 5 Invoke-RestMethod https://api.maitoken.com/v1/chat/completions ` -Method Post ` -Headers @{Authorization="Bearer $env:MAITOKEN_API_KEY"} ` -ContentType "application/json" ` -Body $body2.3 Interpreting the Results
| Result | Meaning |
|---|---|
| A model list is returned | The API Key is valid and can retrieve its model permissions. |
| OK or a normal response is returned | The Chat Completions endpoint is working, and you can begin configuring the client. |
| 401 / Unauthorized | The API Key is incorrect or expired, or the Authorization header is formatted incorrectly. |
| 404 / Not Found | The request path is incorrect. A common cause is duplicating the version path as /v1/v1. |
| model_not_found | The Model ID is incorrect, or the API Key does not have permission to use that model. |
