Authentication
How to authenticate to the LM0 public API with OpenAI or Anthropic header styles.
LM0 accepts both common client authentication styles on every /v1/* route so you can keep stock SDKs unchanged.
Header styles
OpenAI style
Authorization: Bearer lm0_...
Anthropic style
x-api-key: lm0_...
anthropic-version: 2023-06-01
Both styles resolve the same API key. Prefer the style your SDK already sends.
Examples
# OpenAI-style
curl https://api.17.wtf/v1/models \
-H "Authorization: Bearer $LM0_API_KEY"
# Anthropic-style
curl https://api.17.wtf/v1/models \
-H "x-api-key: $LM0_API_KEY" \
-H "anthropic-version: 2023-06-01"
Runtime modes
DB-backed production mode
When the gateway is configured with a database:
- Keys resolve to user records
- Banned accounts are blocked
- Per-user RPM limits apply by account tier
- Package token balance is enforced for generation
- Pool / model restrictions and beta access are enforced
Legacy / local mode
Without a database block:
- Keys come from
virtual_keysin config (optional model allow-list and RPM) - If no virtual keys are configured, the gateway may run open (local/dev only)
Never run open (no-auth) mode on a public network. Use DB-backed keys in production.
Keys
Keys are typically prefixed (for example lm0_…). Create and revoke keys from the product console when available, or via admin APIs in DB mode.
Errors
Common auth-related outcomes:
| Situation | Typical result |
|---|---|
| Missing / invalid key | 401 |
| Banned account | 403 |
| Insufficient credits (DB mode) | 402 |
| Rate limited (RPM) | 429 |
Exact bodies follow the gateway’s error shape for the surface you called.