Send the key as a bearer token
Every call that needs a key carries it in the Authorization header:
curl https://api.studio.dramatis.ai/v1/balance \
|
-H "Authorization: Bearer $OPSIS_API_KEY" |
A key looks like osk_ followed by an id and a secret. The model list needs no key, but a key that is not valid sent to it is refused like on any other call.
Samples on this site use https://api.studio.dramatis.ai/v1. That host is not open yet. The address an invited account should call is given with the invitation.
Keep the key on a server
A key belongs on your server. Never put it in a web page, a mobile app or a repository. If your app runs in a browser or on a phone, put your own server between the app and Dramatis Studio and keep the key there.
Keys covers making, replacing and revoking keys, and what to do if one leaks.
What an unusable key gives
- No key, a malformed key, a revoked key or an expired key:
401 invalid_api_key. The message of an expired key says when it expired. - A key that may not use a model:
403 model_not_allowed. - A key that has reached a spend cap:
402 spend_limit_reached, with the cap indetails.
See Errors for the whole list.
The SDKs
The TypeScript and Python packages are not published yet. The samples show the calls they are meant to make. Both will be named opsis-sdk. The Python import name will be opsis.
Request
curl 'https://api.studio.dramatis.ai/v1/keys/self' \
|
-H "Authorization: Bearer $OPSIS_API_KEY" |