Getting started
Get an API key
How API keys are created, where to find them, and what happens to them over an instance's life.
What an API key is
An API key is a secret that proves a request is yours and says which instance it is for. Keys look like ob_sk_ followed by 64 random characters. Each key belongs to exactly one instance: requests made with it only ever reach that instance's model.
Running two instances? Each has its own keys. Use the key of the instance you want to reach.
How your first key is made
- 1
You buy a time pack
Paying for a model in the console creates your instance.
- 2
We start the instance
We rent the GPU, start your model and lock it with its own pod key, which only our servers hold. When the model answers, the instance is
ready. - 3
You open the ready instance
The first time you open it on My Instances, we generate its default API key from 32 random bytes and show it to you, once.
- 4
We keep only a fingerprint
We store a SHA-256 hash of the key, never the key itself. That is why it can't be shown again: copy it when you see it.
Create more keys
You can hold several active keys per instance, for example one per app, so each can be stopped on its own.
- 1
Open API Keys
Go to API Keys in the console.
- 2
Choose the instance
Only ready instances can get keys.
- 3
Name the key and click Generate Key
The new key is shown once. Copy it into your app's secrets.
Revoke or delete a key
On API Keys, a key you created can be revoked (it stops working at once) or deleted. The default key stays active for as long as its instance runs.
Give each app its own key
Use keys you created, not the default key, in your apps. If one leaks, revoke it and make another, and nothing else breaks.
A key's life
| When | What happens |
|---|---|
| Created when the instance is ready | Open the ready instance on My Instances and a default API key is created for it. The key is shown only once. If you did not copy it, generate a new one under API Keys. |
| One key, one instance | Each API key belongs to exactly one instance. Requests made with that key only ever reach that instance's model. |
| Instance ended → keys revoked | When an instance stops, fails or its pack ends, every key for it is revoked and cannot be used again. A new instance needs a new key. |
| Extend pack → same key | Adding time to an instance keeps the same instance, so its keys keep working. Nothing to rotate. |
| Create another key | Open API Keys, choose the ready instance, name the key and click Generate Key. An instance can have several active keys. |
Note
Playground sessions don't get API keys: keys are for Self Deploy instances. Next, see how to send your key in Authentication.