1. 7API
  2. Docs
  3. Authentication

Authentication

Every API request is authenticated with your 7API key. The gateway accepts either of two headers. Use whichever your client sends by default.

HeaderTypical client
Authorization: Bearer sk-…OpenAI SDKs, most OpenAI-compatible tools
x-api-key: sk-…Anthropic SDKs, Claude Code

If a request carries both, x-api-key wins. No other header or query parameter is read. In particular, ?key= in the URL does not work.

bash
curl https://7api.st/v1/models -H "Authorization: Bearer sk-your-key"
curl https://7api.st/v1/models -H "x-api-key: sk-your-key"

Key format

Keys are sk- followed by 48 lowercase hexadecimal characters, 51 characters in total. Treat a key like a password. It authorizes spending from your balance, and on the website it also acts as your login.

Missing or invalid keys

The generation endpoints check the key before reading the request body. A bad key gets an immediate 401 in Anthropic error format:

json
{ "error": { "type": "authentication_error", "message": "Invalid API key" } }

The account endpoints (/v1/balance, /v1/usage, /v1/status, /v1/subkeys) answer in OpenAI error format:

json
{ "error": { "message": "Invalid API key", "type": "invalid_request_error", "param": null, "code": "invalid_api_key" } }

GET /v1/models works without a key and returns the public catalog. With a key, it returns the models available to that account.

Rotating a key

Rotate your key from Overview → Rotate in the dashboard, or with the Telegram bot. The site shows the new key and asks you to confirm you've saved it. Only then does the old key stop working. Update every tool that used the old key. Your balance and usage history stay with the account.

Keys for other people

Don't share your main key. Create a subkey instead: a separate key funded from your balance, with its own spend tracking, that you can drain or revoke at any time.

Browser use

The API sends Access-Control-Allow-Origin: *, so requests from a browser work. Calling the API directly from a public web page exposes your key to every visitor, though. Route browser traffic through your own backend, or give each user a low-balance subkey.