Skip to content

Authentication and API keys

Send your complete key in the request header, not in a URL query string:

Authorization: Bearer YOUR_WUDI_API_KEY
Content-Type: application/json

In an API Key input field, enter the key itself. Do not add another Bearer prefix: the client or SDK constructs the header.

For a model and route supporting Messages, use the client’s required authentication and version headers:

x-api-key: YOUR_WUDI_API_KEY
anthropic-version: 2023-06-01
content-type: application/json

Claude Code can use ANTHROPIC_AUTH_TOKEN, which sends Bearer authentication. Avoid conflicting authentication variables. See Claude Code and Messages.

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

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.