Authentication and API keys
OpenAI-compatible authentication
Section titled “OpenAI-compatible authentication”Send your complete key in the request header, not in a URL query string:
Authorization: Bearer YOUR_WUDI_API_KEYContent-Type: application/jsonIn an API Key input field, enter the key itself. Do not add another Bearer prefix: the client or SDK constructs the header.
Anthropic-compatible authentication
Section titled “Anthropic-compatible authentication”For a model and route supporting Messages, use the client’s required authentication and version headers:
x-api-key: YOUR_WUDI_API_KEYanthropic-version: 2023-06-01content-type: application/jsonClaude Code can use ANTHROPIC_AUTH_TOKEN, which sends Bearer authentication. Avoid conflicting authentication variables. See Claude Code and Messages.
Which models can a key use?
Section titled “Which models can a key use?”Access depends on the account, selected group, model allowlist, key allowance, expiry and any configured IP restrictions. A key does not automatically have access to the whole catalog. Query GET /v1/models, then test the target model with its supported protocol.
| Symptom | Check first |
|---|---|
| 401 or invalid token | Complete key, whitespace, deletion and expiry |
| 403 or permission denied | Group, model restrictions and IP restrictions |
| Insufficient credit | Both account balance and key allowance |
| Connection test passes but generation fails | Exact model ID, endpoint and parameters |
Key management
Section titled “Key management”Use a separate key for each application so you can revoke and reconcile them independently. Use placeholders in screenshots, public repositories and documentation. If a key leaks, disable it and create a replacement; changing your account password does not revoke an API key.
Keep service credentials on your server. Exclude environment files from version control, and route browser requests through your own backend rather than embedding a key in public JavaScript.
