API keys and scopes
Create keys in API keys. Hosted account keys use an osk_ prefix and authenticate through Authorization: Bearer YOUR_OPENSENPAI_API_KEY. The credential determines account access; requests cannot choose another account through a header or tool argument.
Choose scopes
Section titled “Choose scopes”| Scope | Access |
|---|---|
read |
Account balance, private runs, observations, run listing, and MCP get_balance. |
write |
Start research runs and request cancellation. |
billing |
Read ledger/purchase history and create checkout sessions. |
keys |
List, create, and revoke account keys. |
Discovery and estimation are free public operations. A normal research integration can use read and write without receiving purchase or key-management permissions. A reporting integration can use read alone. Callers cannot delegate permissions they do not possess.
Create and save
Section titled “Create and save”Name a key after its purpose, such as “local research client.” Labels contain 1–120 trimmed characters. Optional expiry must be a future ISO timestamp. Accounts support at most 100 active, unexpired credentials.
The key-creation response is {secret, key} and discloses secret once. Later list requests return metadata without the credential secret. Save it in your client’s secret settings or a secret manager immediately. If you lose it, create a replacement; it cannot be recovered from the list.
For REST key management, POST /api/v1/account/keys accepts:
{ "label": "local research client", "scopes": ["read", "write"]}Rotate or revoke
Section titled “Rotate or revoke”Create a replacement key, update the integration, verify it can read the expected account, and revoke the old key through the portal. Revocation is also available through DELETE /api/v1/account/keys/:id with keys scope. A revoked key should be removed from client configuration.
Paid guest credentials use an osg_ prefix and are distinct from account-managed keys. Guests cannot manage keys. Treat guest credentials as private bearer secrets as well.
For 401 or 403 responses, check expiry, revocation, header formatting, and scopes using authentication troubleshooting.