Authentication
One secret per key, sent as a Bearer token. Keys can be scoped and capped.
Sending the key
Keys look like vk-.... Send them in the standard header:
Authorization: Bearer vk-...Clients that cannot set Authorization may use the alternative header instead:
x-api-key: vk-...The Authorization header wins if both are present. The same rule covers every key-authenticated route: chat completions, search, scrape and balance.GET /v1/models is public and needs no key.
curl https://venym.io/v1/balance -H "x-api-key: $VENYM_API_KEY"How keys are stored
We keep a hash of the key, not the key. That is why the secret is shown once at creation. If you lose it, revoke it and make a new one. A revoked key stops working immediately.
Key scoping
Set these when you create a key, or edit them later in Dashboard, API keys.
402 key_spend_limit. Reset the counter from the dashboard to reopen it.403 model_not_allowed. Empty means all models.Failure modes
- No key sent:
401with codemissing_key. - Unknown or revoked key:
401with codeinvalid_key. - Account suspended:
403with codesuspended.
Full list on the errors page.
Browser use
The API sends permissive CORS headers (authorization, content-type and x-api-key allowed), so it works from a browser. Do not ship a key in public front-end code: anyone can read it. Put a spend limit on any key that has to live client-side.