Connect a model provider
Add the API key of a provider as a connection, check that it works, and rotate, switch off or delete it later.
4 min read
A connection is the credentials of one provider account that Slen calls models through. Without a connection no model can be called, so adding one is the first step of setting up a project. This page is about the connections page of the console.
Where the connections are
Open Settings, then Connections. The page lists the connections of the project chosen in the header and the connections of the whole organization. A row says which of the two a connection is.
The page opens for whoever has the management:read permission. Adding, checking and changing a connection need management:write. A connection of the whole organization is changed only by a member who reaches every project.
Add a connection
1. Start a new connection
Press New connection.
2. Name it and choose the provider
Fill in Name and choose the Provider: OpenAI, Anthropic or Google.
3. Paste the key
In API key paste a key of your account with the provider. Slen stores the key encrypted and never shows it again. The list shows its last four characters.
4. Choose where it applies
Under Applies to choose This project or Whole organization. The second choice is offered only to a member who reaches every project.
5. Choose the environment
Under Environment choose Production or Staging, the environment the key is meant for. The region is optional.
6. Create the connection
Press Create connection.
Find your OpenAI API key
The key comes from your account with OpenAI, not from Slen: OpenAI bills the requests made with it to that account.
Sign in to the OpenAI platform and open the page of API keys.
Create a new secret key. OpenAI shows a key once: copy it right away.
Paste it into API key, on the connections page or on the provider step of the first setup.
A key that OpenAI no longer accepts is rejected by the check, and the connection goes into the Error state. Create another key with OpenAI and put it in with Rotate key.
Check a connection
Press Check in the row of the connection. Slen asks the provider for its list of models with the stored key. The check calls no model and spends no tokens.
The provider accepts the key: the row shows the time of the check and how long the provider took to answer.
The provider answers with a rate limit: the key works, and the check passes.
The provider rejects the key: the connection goes into the Error state.
A check does not change a disabled connection: whatever the provider answers, the connection stays Disabled. Only Enable brings it back.
What the state means
| State | What it means |
|---|---|
| Not checked | The connection has not been checked yet |
| Healthy | The key works |
| Degraded | Too many of the recent attempts through the connection failed |
| Paused | Slen has set the connection aside after a rate limit or an outage of the provider, or the connection was paused through the API. The pause ends by itself |
| Error | The provider rejected the key. Rotate the key |
| Disabled | The connection is switched off |
Which connection a request uses
When a provider pool serves the request, the pool chooses among its connections.
When no pool does, Slen takes one active connection of the provider of the model: a connection of the project before one of the whole organization, the oldest first. It makes one attempt.
When the provider of the model has no connection that can serve, the request is refused with the code
provider_not_configured.
Read the metrics
Press a row, or Metrics in it, to open the page of the connection. For the last 24 hours, 7 days or 30 days it shows the number of requests, the share that succeeded, the latency and the cost. Under them it counts the errors: the rate limits, the errors of the provider and the timeouts.
Rotate, switch off or delete
The menu in the row of a connection holds three actions.
| Action | What it does |
|---|---|
| Rotate key | Replaces the key. The old key stops being used the moment the new one is saved. A connection in the Error state becomes active again |
| Disable | Requests stop using the connection at once. Enable brings it back |
| Delete | Destroys the key, after a confirmation, and takes the connection out of every pool that lists it |
A connection that is the last enabled one of a pool is not deleted: the request is refused with the code connection_in_use. Add another connection to the pool first.
Where to go next
Quickstart — the next step: send the first request.
Models and prices — the models a connection gives access to.
Provider connections — the same connections over the API.
Glossary — a provider, a connection and a pool in one line each.
Error codes — every code of the API, what it means and what to do about it.
Provider pools — put the connections in a failover order.