Test the connection (cURL / PowerShell)
Confirm your key, base URL and balance work — before touching any SDK or IDE.
Step 1 — Create an API key
- Open API Keys in the dashboard and create a new key.
- Copy it NOW — it is shown exactly once; ApiLux stores only a hash.
- Put it in an environment variable, not in source code.
$env:APILUX_API_KEY = "apl_YOUR_API_KEY"export APILUX_API_KEY="apl_YOUR_API_KEY"Step 2 — Pick a model
List the models you can actually call. This endpoint is read-only and is NOT billed.
curl https://apilux.net/api/v1/models \
-H "Authorization: Bearer apl_YOUR_API_KEY"Only use an
id returned here. The catalogue changes over time, so do not hardcode an ID from documentation.Step 3 — Make a call
curl https://apilux.net/api/v1/chat/completions \
-H "Authorization: Bearer apl_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"messages": [{ "role": "user", "content": "Xin chao" }]
}'Do NOT add stream: true. ApiLux does not support streaming yet and rejects it explicitly with 400 — deliberately, because silently returning non-streaming would hang an SSE client.
Configuration summary
| Item | Value |
|---|---|
| Base URL | https://apilux.net/api/v1 |
| Key variable | APILUX_API_KEY |
| Base URL variable | APILUX_BASE_URL |
| Wire protocol | chat.completions (streaming supported) |
Troubleshooting
| Error | Cause and fix |
|---|---|
| 401 | Wrong or revoked key. Create a new one on the API Keys page. |
| 402 | Insufficient balance. Top up and retry. |
| 404 | Wrong base URL, or you are calling an endpoint ApiLux does not have yet (for example /messages, /responses). |
| 400 unknown_model | The model is not in your GET /models list. Pick an id from there. |
| 400 streaming | You sent stream: true. Remove that field. |
| 429 | Rate limit exceeded. Read the Retry-After header and wait that many seconds. |
| 503 | The model is temporarily unavailable, or the system is in maintenance. You are not charged. |
| Timeout | Seconds are enough for chat; use 180-360s for images; video returns a job immediately, then poll. |