API console: byok
Cette page est générée à partir de server/api/openapi.yaml. Son contenu est en anglais ; ne la modifiez pas à la main.
Bring your own key (V3 R5): the active organisation’s own upstream API keys. Requests of models a key’s provider
serves go to that provider with the customer’s key, before the platform’s own channels; the platform then charges
only a service fee (settings byok.service_fee_ppm, byok.service_fee_per_request_nano). Keys are stored sealed
and only their last four characters are returned. Reads need the billing view permission, changes owner or admin.
Handlers: internal/console/byok.
GET /api/v1/org/byok/providers
Section intitulée « GET /api/v1/org/byok/providers »Providers a BYOK key can be registered for, and the current service fee
operationId byokProviders · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json ByokProviders |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — ByokProviders
data(array of ByokProvider, required)id(string, required)name(string, required)protocol(string, required) — Upstream protocol of the provider’s API (openai_compat, anthropic, gemini).
custom_base_url_allowed(boolean, required)service_fee_ppm(integer, required) — Share of the platform price charged for a request served with an own key, in ppm (50000 = 5%). service_fee_per_request_nano(NanoUSD, required, pattern: ”^-?[0-9]+$”) — An amount of money in nano-USD (1 USD = 1,000,000,000) as a decimal integer string. It is a string because an int64 does not survive JavaScript numbers. Never a float.
GET /api/v1/org/byok/keys
Section intitulée « GET /api/v1/org/byok/keys »List the organisation’s BYOK keys
operationId byokKeyList · auth: orgSession
In routing order (position, then creation). Requires the billing view permission.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json ByokKeyList |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — ByokKeyList
data(array of ByokKey, required)id(string, required) provider(string, required)name(string, required)base_url(string, required, nullable) — Custom endpoint; null = the provider’s own.key_last4(string, required)position(integer, required) — Routing order among the organisation’s keys, lower first. status(ByokKeyStatus, required) —disabled: turned off by a member.invalid: the provider rejected the key (taken out of routing; the billing contacts were emailed).status_reason(string, required)status_changed_at(string, required, nullable) last_verified_at(string, required, nullable) last_verify_status(string, required) —ok,auth_failed,unreachable,error, or empty when never verified.last_used_at(string, required, nullable) created_by(string, required, nullable) created_at(string, required) updated_at(string, required)
POST /api/v1/org/byok/keys
Section intitulée « POST /api/v1/org/byok/keys »Register a BYOK key
operationId byokKeyCreate · auth: orgSession
Requires owner or admin. At most 20 keys per organisation. base_url is refused unless the operator enabled
custom base URLs (custom_base_url_allowed in byokProviders); it must then be https and resolve to public
addresses only. The key is not called here: use byokKeyVerify.
Request body (required) application/json — ByokKeyInput
provider(string, required) — One of byokProviders.name(string, required, minLength: 1, maxLength: 100)api_key(string, required, minLength: 8, maxLength: 512) — The provider key. Write-only.base_url(string, nullable)position(integer, minimum: 0, maximum: 1000)
| Status | Meaning | Body |
|---|---|---|
| 201 | OK | application/json ByokKey |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 201 application/json — ByokKey
id(string, required) provider(string, required)name(string, required)base_url(string, required, nullable) — Custom endpoint; null = the provider’s own.key_last4(string, required)position(integer, required) — Routing order among the organisation’s keys, lower first. status(ByokKeyStatus, required) —disabled: turned off by a member.invalid: the provider rejected the key (taken out of routing; the billing contacts were emailed).status_reason(string, required)status_changed_at(string, required, nullable) last_verified_at(string, required, nullable) last_verify_status(string, required) —ok,auth_failed,unreachable,error, or empty when never verified.last_used_at(string, required, nullable) created_by(string, required, nullable) created_at(string, required) updated_at(string, required)
PATCH /api/v1/org/byok/keys/{byok_key_id}
Section intitulée « PATCH /api/v1/org/byok/keys/{byok_key_id} »Rename, reorder, enable or disable a BYOK key, or replace its secret
operationId byokKeyUpdate · auth: orgSession
Requires owner or admin. Enabling, or replacing the secret, makes an invalid key active again.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
byok_key_id |
path | string<uuid> | yes |
Request body (required) application/json — ByokKeyUpdate
name(string, minLength: 1, maxLength: 100)position(integer, minimum: 0, maximum: 1000) enabled(boolean)api_key(string, minLength: 8, maxLength: 512) — Replaces the secret. Write-only.
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json ByokKey |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — ByokKey
id(string, required) provider(string, required)name(string, required)base_url(string, required, nullable) — Custom endpoint; null = the provider’s own.key_last4(string, required)position(integer, required) — Routing order among the organisation’s keys, lower first. status(ByokKeyStatus, required) —disabled: turned off by a member.invalid: the provider rejected the key (taken out of routing; the billing contacts were emailed).status_reason(string, required)status_changed_at(string, required, nullable) last_verified_at(string, required, nullable) last_verify_status(string, required) —ok,auth_failed,unreachable,error, or empty when never verified.last_used_at(string, required, nullable) created_by(string, required, nullable) created_at(string, required) updated_at(string, required)
DELETE /api/v1/org/byok/keys/{byok_key_id}
Section intitulée « DELETE /api/v1/org/byok/keys/{byok_key_id} »Delete a BYOK key
operationId byokKeyDelete · auth: orgSession
Permanent. Requires owner or admin. Usage records keep the key id.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
byok_key_id |
path | string<uuid> | yes |
| Status | Meaning | Body |
|---|---|---|
| 204 | Deleted | — |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
POST /api/v1/org/byok/keys/{byok_key_id}/verify
Section intitulée « POST /api/v1/org/byok/keys/{byok_key_id}/verify »Check a BYOK key against its provider
operationId byokKeyVerify · auth: orgSession
Requires owner or admin. One request to the provider’s model list with the key. A 401/403 marks the key
invalid; success makes an invalid key active again. Other failures change nothing.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
byok_key_id |
path | string<uuid> | yes |
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json ByokVerifyResult |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — ByokVerifyResult
ok(boolean, required)status(string, required) —ok,auth_failed(the key is nowinvalid),unreachableorerror.http_status(integer, required) — The provider’s HTTP status; 0 when it could not be reached. message(string, required)key(ByokKey, required) — A BYOK key without its secret.id(string, required) provider(string, required)name(string, required)base_url(string, required, nullable) — Custom endpoint; null = the provider’s own.key_last4(string, required)position(integer, required) — Routing order among the organisation’s keys, lower first. status(ByokKeyStatus, required) —disabled: turned off by a member.invalid: the provider rejected the key (taken out of routing; the billing contacts were emailed).status_reason(string, required)status_changed_at(string, required, nullable) last_verified_at(string, required, nullable) last_verify_status(string, required) —ok,auth_failed,unreachable,error, or empty when never verified.last_used_at(string, required, nullable) created_by(string, required, nullable) created_at(string, required) updated_at(string, required)
GET /api/v1/org/byok/settings
Section intitulée « GET /api/v1/org/byok/settings »The organisation’s BYOK settings
operationId byokSettingsGet · auth: orgSession
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json ByokSettings |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — ByokSettings
fallback_to_platform(boolean, required) — When every own key failed for a model, use the platform’s channels at the normal price.updated_at(string, required, nullable)
PUT /api/v1/org/byok/settings
Section intitulée « PUT /api/v1/org/byok/settings »Change the organisation’s BYOK settings
operationId byokSettingsUpdate · auth: orgSession
Requires owner or admin.
Request body (required) application/json — ByokSettingsInput
fallback_to_platform(boolean, required)
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | application/json ByokSettings |
| default | Error envelope. The HTTP status follows the error kind. | application/json Error |
Response 200 application/json — ByokSettings
fallback_to_platform(boolean, required) — When every own key failed for a model, use the platform’s channels at the normal price.updated_at(string, required, nullable)