Ключи провайдеров, лимиты и паузы

Сохраните API-ключ провайдера моделей, проверьте, что он работает, задайте его лимиты и на время выведите его из работы.

Подключение провайдера — это API-ключ провайдера моделей, сохранённый в Slen. Вызов модели доходит до провайдера через подключение. Операции этой страницы сохраняют ключ, проверяют его, ограничивают, ставят на паузу и сообщают, как он себя вёл. Консоль показывает те же подключения на экране Подключения.

Секрет

Ключ провайдера записывается и никогда не читается обратно. Ни один ответ его не несёт: подключение показывает secret_configured и, в secret_last_four, последние четыре символа ключа.

Отправьте ключ в api_key, когда создаёте подключение. Чтобы заменить его, отправьте новый api_key в обновлении. Создание подключения не обращается к провайдеру, поэтому запустите проверку, чтобы узнать, работает ли ключ.

Проект и организация

Подключение принадлежит одному проекту или всей организации. У подключения организации project_id равно null, и через него может отправлять вызовы любой проект.

API-ключ действует в своём проекте.

  • Он получает список подключений своего проекта и организации и читает их.

  • Он создаёт подключение в своём проекте. Скажите об этом значением project в scope: запрос, который не называет проект, просит подключение организации и отвечает 403 с кодом project_access_restricted.

  • Он не может изменить подключение организации. Запись в такое подключение — обновление, включение, отключение, удаление, проверка, лимиты, пауза — отвечает тем же 403.

Подключение другого проекта или подключение, которого не существует, отвечает 404 с кодом provider_connection_not_found.

Статус и состояние

У подключения два состояния.

status хранится: active, disabled или invalid_credentials. Вызовы принимает только подключение со статусом active. Вы задаёте disabled и active, отключая и включая подключение или передавая status в обновлении. Slen ставит invalid_credentials, когда провайдер отклоняет ключ активного подключения, и снова ставит active, когда сохранён новый ключ или проверка прошла успешно. Отключённое подключение остаётся disabled, что бы ни показала проверка и какой бы ключ ни был сохранён: вернуть его в работу может только ваш собственный запрос — включение или обновление со status, равным active.

health_status вычисляется для каждого ответа. Это первое подходящее из значений: disabled, invalid_credentials, cooldown, degraded, healthy. degraded говорит, что слишком много недавних попыток через подключение завершились неудачей, а error_rate — это доля таких попыток.

Удаление

Удалённое подключение сохраняется. Оно получает deleted_at, становится disabled и уходит из всех пулов, в которых было. Список его не показывает, если не отправить include_deleted=1. Включение удалённого подключения восстанавливает его, но не его место в пулах. Вернуть удалённое подключение можно только включением: status в обновлении удаление не отменяет.

Удаление последнего включённого подключения пула отклоняется: 409 с кодом connection_in_use.

Проверка

Проверка запрашивает у провайдера список его моделей с сохранённым ключом, что не стоит токенов. Результат записывается в подключение: last_health_check_at, last_health_latency_ms и статус invalid_credentials, когда отклонён ключ подключения, которое не отключено.

Когда провайдер отвечает, что для ключа исчерпан лимит запросов, ok всё равно равно true: ключ действителен, а остальное говорит rate_limited.

Проверка принимает шесть вызовов в минуту от одного API-ключа. Следующий вызов отвечает 429 с кодом rate_limit_exceeded.

Лимиты и пауза

Строка лимитов относится к одной модели. Строка без model — это значение по умолчанию для всего подключения. Обновление записывает каждую строку, которую называет тело, и оставляет остальные строки как есть. Строка записывается целиком: лимит, который строка не называет, очищается, а строка, не называющая ни одного лимита, удаляется.

Пауза выводит подключение из работы на duration_seconds. Вторая пауза может сделать идущую длиннее, но не короче. Пока идёт пауза, cooldown_until говорит, когда она закончится. Снятие завершает все идущие паузы подключения, в том числе те, которые начал сам Slen.

Операции

Описания операций и полей приведены на английском.

Список подключений к провайдерам

GET /v1/provider-connections

  • Разрешение: management:read

Mutations on this group are audited.

Параметры

ПараметрОписание
limit необязательно

queryinteger

Page size (default 30).

  • Минимум: 1
  • Максимум: 100
cursor необязательно

querystring

The meta.next_cursor of the previous page.

provider необязательно

queryProviderCode

  • Одно из: openai, anthropic, google
environment необязательно

queryProviderEnvironment

  • Одно из: production, staging
status необязательно

queryProviderConnectionStatus

  • Одно из: active, disabled, invalid_credentials
include_deleted необязательно

queryinteger

1 lists the soft-deleted connections too; 0, the default, hides them. 1 or 0: true and false are a field-validation 422.

  • Одно из: 0, 1
  • По умолчанию: 0
project необязательно

querystring

current narrows the list to the active project — an API key's own, a person's as switched on POST /api/auth/me/project — plus the organization's rows where the resource has them. A literal, never an id: anything else is 422. Without it the list is everything within the caller's reach.

  • Одно из: current

Ответы

200

One cursor page of connections

application/json
{
  "data": [
    {
      "provider_connection_id": "74438200973594624",
      "organization_id": "74438200973594624",
      "project_id": "74438200973594624",
      "provider": "openai",
      "name": "string",
      "environment": "production",
      "region": "string",
      "provider_organization_id": "74438200973594624",
      "provider_project_id": "74438200973594624",
      "status": "active",
      "health_status": "healthy",
      "cooldown_until": "2026-10-02T09:30:00Z",
      "error_rate": "string",
      "secret_last_four": "string",
      "secret_configured": true,
      "last_health_check_at": "2026-10-02T09:30:00Z",
      "last_health_latency_ms": 1,
      "deleted_at": "2026-10-02T09:30:00Z",
      "created_at": "2026-10-02T09:30:00Z",
      "updated_at": "2026-10-02T09:30:00Z"
    }
  ],
  "meta": {
    "limit": 1,
    "next_cursor": "string"
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Создать подключение к провайдеру

POST /v1/provider-connections

  • Разрешение: management:write

The secret is never returned by any endpoint — only secret_last_four and secret_configured.

The connection belongs to the caller's organization. A project_id outside it or out of the caller's reach, or an organization_id other than the caller's, answers 404 (project_not_found / organization_not_found) and stores nothing — the same answer as an id that does not exist.

scope names the side instead of a raw id: project is the active project, organization (also the default without scope and project_id) is no project and needs a caller that reaches every project (403 project_access_restricted). scope together with project_id is 422.

Тело запроса

application/json
{
  "organization_id": "74438200973594624",
  "project_id": "74438200973594624",
  "scope": "organization",
  "provider": "openai",
  "name": "string",
  "api_key": "string",
  "secret": "string",
  "environment": "production",
  "region": "string",
  "provider_organization_id": "74438200973594624",
  "provider_project_id": "74438200973594624"
}

Ответы

201

The created connection

application/json
{
  "data": {
    "provider_connection_id": "74438200973594624",
    "organization_id": "74438200973594624",
    "project_id": "74438200973594624",
    "provider": "openai",
    "name": "string",
    "environment": "production",
    "region": "string",
    "provider_organization_id": "74438200973594624",
    "provider_project_id": "74438200973594624",
    "status": "active",
    "health_status": "healthy",
    "cooldown_until": "2026-10-02T09:30:00Z",
    "error_rate": "string",
    "secret_last_four": "string",
    "secret_configured": true,
    "last_health_check_at": "2026-10-02T09:30:00Z",
    "last_health_latency_ms": 1,
    "deleted_at": "2026-10-02T09:30:00Z",
    "created_at": "2026-10-02T09:30:00Z",
    "updated_at": "2026-10-02T09:30:00Z"
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Одно подключение

GET /v1/provider-connections/{id}

  • Разрешение: management:read

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

200

The connection

application/json
{
  "data": {
    "provider_connection_id": "74438200973594624",
    "organization_id": "74438200973594624",
    "project_id": "74438200973594624",
    "provider": "openai",
    "name": "string",
    "environment": "production",
    "region": "string",
    "provider_organization_id": "74438200973594624",
    "provider_project_id": "74438200973594624",
    "status": "active",
    "health_status": "healthy",
    "cooldown_until": "2026-10-02T09:30:00Z",
    "error_rate": "string",
    "secret_last_four": "string",
    "secret_configured": true,
    "last_health_check_at": "2026-10-02T09:30:00Z",
    "last_health_latency_ms": 1,
    "deleted_at": "2026-10-02T09:30:00Z",
    "created_at": "2026-10-02T09:30:00Z",
    "updated_at": "2026-10-02T09:30:00Z"
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Изменить подключение или сменить его секрет

PATCH /v1/provider-connections/{id}

  • Разрешение: management:write

A new key (api_key) lifts the auth_error pause and an invalid_credentials verdict back to active; it never switches on a disabled or deleted connection.

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Тело запроса

application/json
{
  "name": "string",
  "status": "active",
  "api_key": "string",
  "secret": "string",
  "environment": "production",
  "region": "string",
  "provider_organization_id": "74438200973594624",
  "provider_project_id": "74438200973594624"
}

Ответы

200

The updated connection

application/json
{
  "data": {
    "provider_connection_id": "74438200973594624",
    "organization_id": "74438200973594624",
    "project_id": "74438200973594624",
    "provider": "openai",
    "name": "string",
    "environment": "production",
    "region": "string",
    "provider_organization_id": "74438200973594624",
    "provider_project_id": "74438200973594624",
    "status": "active",
    "health_status": "healthy",
    "cooldown_until": "2026-10-02T09:30:00Z",
    "error_rate": "string",
    "secret_last_four": "string",
    "secret_configured": true,
    "last_health_check_at": "2026-10-02T09:30:00Z",
    "last_health_latency_ms": 1,
    "deleted_at": "2026-10-02T09:30:00Z",
    "created_at": "2026-10-02T09:30:00Z",
    "updated_at": "2026-10-02T09:30:00Z"
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Удалить подключение

DELETE /v1/provider-connections/{id}

  • Разрешение: management:write

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

204

Deleted

Без тела

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

409

State conflict: idempotency clash, stale draft, illegal transition; the last owner of an organization (last_owner); the owned-organization limit (organization_limit_reached); an end customer with credit history that cannot be deleted (customer_has_history)

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Снова включить подключение

POST /v1/provider-connections/{id}/enable

  • Разрешение: management:write

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

200

The enabled connection

application/json
{
  "data": {
    "provider_connection_id": "74438200973594624",
    "organization_id": "74438200973594624",
    "project_id": "74438200973594624",
    "provider": "openai",
    "name": "string",
    "environment": "production",
    "region": "string",
    "provider_organization_id": "74438200973594624",
    "provider_project_id": "74438200973594624",
    "status": "active",
    "health_status": "healthy",
    "cooldown_until": "2026-10-02T09:30:00Z",
    "error_rate": "string",
    "secret_last_four": "string",
    "secret_configured": true,
    "last_health_check_at": "2026-10-02T09:30:00Z",
    "last_health_latency_ms": 1,
    "deleted_at": "2026-10-02T09:30:00Z",
    "created_at": "2026-10-02T09:30:00Z",
    "updated_at": "2026-10-02T09:30:00Z"
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Выключить подключение, не удаляя его

POST /v1/provider-connections/{id}/disable

  • Разрешение: management:write

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

200

The disabled connection

application/json
{
  "data": {
    "provider_connection_id": "74438200973594624",
    "organization_id": "74438200973594624",
    "project_id": "74438200973594624",
    "provider": "openai",
    "name": "string",
    "environment": "production",
    "region": "string",
    "provider_organization_id": "74438200973594624",
    "provider_project_id": "74438200973594624",
    "status": "active",
    "health_status": "healthy",
    "cooldown_until": "2026-10-02T09:30:00Z",
    "error_rate": "string",
    "secret_last_four": "string",
    "secret_configured": true,
    "last_health_check_at": "2026-10-02T09:30:00Z",
    "last_health_latency_ms": 1,
    "deleted_at": "2026-10-02T09:30:00Z",
    "created_at": "2026-10-02T09:30:00Z",
    "updated_at": "2026-10-02T09:30:00Z"
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Проверить подключение у провайдера

POST /v1/provider-connections/{id}/test

  • Разрешение: management:write

Tighter bucket than the rest of the plane (6/min per key): this call leaves our network.

The verdict is stored. A refused key marks an active connection invalid_credentials (it leaves pool selection); a later good answer, or a new key (PATCH with api_key), lifts it back to active. A disabled or deleted connection keeps its status whatever the answer. A disabled connection is switched back on only by an explicit action — POST /v1/provider-connections/{id}/enable or status in PATCH; a deleted one only by enable, which clears its deletion.

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

200

The verification result

application/json
{
  "data": {
    "ok": true,
    "latency_ms": 1,
    "checked_at": "2026-10-02T09:30:00Z",
    "error_code": "string",
    "rate_limited": true
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

429

Rate limited for this API key

Заголовки

  • X-Request-Id
  • Retry-After429

Тело каждой ошибки — конверт ошибки.

Лимиты частоты запросов подключения

GET /v1/provider-connections/{id}/limits

  • Разрешение: management:read

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

200

One row per model, plus the connection-wide default

application/json
{
  "data": [
    {
      "model": "gpt-4o-mini",
      "rpm": 1,
      "tpm": 1,
      "input_tpm": 1,
      "output_tpm": 1,
      "max_concurrency": 1,
      "daily_quota": 1,
      "source": "manual"
    }
  ]
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Задать лимиты частоты для модели подключения

PUT /v1/provider-connections/{id}/limits

  • Разрешение: management:write

Writes the rows it names and leaves the others as they are: each item of limits is the row of one model (empty or null — the connection-wide row), and that row's six values are replaced as a whole — a value left out is no longer limited. An item whose six values are all empty removes its row. A row the body does not name keeps what it had, so this is not a replacement of the connection's limits: to drop a row, name it with no values. A written row becomes source: manual. Items are applied in order, so a model named twice ends with its last item. The answer is every row the connection has after the write.

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Тело запроса

application/json
{
  "limits": [
    {
      "model": "gpt-4o-mini",
      "rpm": 1,
      "tpm": 1,
      "input_tpm": 1,
      "output_tpm": 1,
      "max_concurrency": 1,
      "daily_quota": 1
    }
  ]
}

Ответы

200

The stored limits

application/json
{
  "data": [
    {
      "model": "gpt-4o-mini",
      "rpm": 1,
      "tpm": 1,
      "input_tpm": 1,
      "output_tpm": 1,
      "max_concurrency": 1,
      "daily_quota": 1,
      "source": "manual"
    }
  ]
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Поставить подключение на паузу

POST /v1/provider-connections/{id}/cooldown

  • Разрешение: management:write

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Тело запроса

application/json
{
  "duration_seconds": 1,
  "reason": "rate_limit"
}

Ответы

200

The cooldown in force

application/json
{
  "data": {
    "connection_id": "74438200973594624",
    "reason": "rate_limit",
    "source": "headers",
    "starts_at": "2026-10-02T09:30:00Z",
    "expires_at": "2026-10-02T09:30:00Z",
    "retry_after_seconds": 1
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Снять паузу досрочно

DELETE /v1/provider-connections/{id}/cooldown

  • Разрешение: management:write

A connection of no project (the organization's) is written only by a caller that reaches every project; an API key or a member of selected projects hears 403 project_access_restricted.

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624

Ответы

204

Released

Без тела

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Нагрузка, сбои и задержка подключения

GET /v1/provider-connections/{id}/analytics

  • Разрешение: read

Параметры

ПараметрОписание
id обязательно

pathId

Snowflake identifier, as a string.

  • Шаблон: ^\d+$
  • Пример: 74438200973594624
from необязательно

querystring

Start of the window an analytics answer covers — a date the server can parse, ISO-8601 recommended (a value without an offset is read as UTC). Unlike the lists, each end is optional on its own and the window is never refused, only fitted (AnalyticsWindowResolver):

  • Формат: date-time
to необязательно

querystring

End of the window an analytics answer covers; now when absent. See from (WindowFrom) for how the window is fitted rather than refused.

  • Формат: date-time

Ответы

200

Connection analytics for the window

application/json
{
  "data": {
    "connection_id": "74438200973594624",
    "window": {
      "from": "2026-10-02T09:30:00Z",
      "to": "2026-10-02T09:30:00Z"
    },
    "requests": 1,
    "succeeded": 1,
    "success_rate": "string",
    "rate_limited_count": 1,
    "timeout_count": 1,
    "provider_error_count": 1,
    "uncertain_count": 1,
    "avg_latency_ms": 1,
    "p95_latency_ms": 1,
    "cost": "0.02700000",
    "successful_failovers": 1,
    "cooldown_seconds": 1
  }
}

Ошибки

СтатусКодыКогда
401

No credential, or one that is not valid

403

Authenticated, but not allowed: scope (insufficient_scope), policy or tenant (not_a_member); a blocked end customer (customer_blocked); an act only a signed-in person may take (session_required); the role rule on members and invitations (member_forbidden, invite_forbidden); a write to the organization's own rows, or a read of the audit journal, by a caller that does not reach every project (project_access_restricted)

404

No such resource for this tenant. Somebody else's resource — and a resource of a project the caller does not reach — answers the same way on purpose: the two must not be distinguishable.

422

Validation failure or a semantically impossible request. Field-level validation from the framework answers {"message", "errors"}; domain refusals answer the standard error envelope. An Idempotency-Key longer than 190 characters is invalid_request in that envelope.

Заголовки

  • X-Request-Id

Тело каждой ошибки — конверт ошибки.

Примеры

Получить список подключений

Два фильтра сужают список до активных подключений одного провайдера.

Terminal
curl "https://api.slen.ai/api/v1/provider-connections?provider=openai&status=active" \
  -H "Authorization: Bearer $SLEN_API_KEY"

Сохранить ключ провайдера

scope помещает подключение в проект ключа. Ответ показывает последние четыре символа ключа провайдера и больше ничего из него.

Terminal
curl https://api.slen.ai/api/v1/provider-connections \
  -H "Authorization: Bearer $SLEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "project",
    "provider": "openai",
    "name": "OpenAI production",
    "api_key": "sk-proj-4f9a...c81d"
  }'
201 Created
{
  "data": {
    "provider_connection_id": "74438912450035712",
    "organization_id": "74438200973594112",
    "project_id": "74438200973594624",
    "provider": "openai",
    "name": "OpenAI production",
    "environment": "production",
    "region": null,
    "provider_organization_id": null,
    "provider_project_id": null,
    "status": "active",
    "health_status": "healthy",
    "cooldown_until": null,
    "error_rate": null,
    "secret_last_four": "c81d",
    "secret_configured": true,
    "last_health_check_at": null,
    "last_health_latency_ms": null,
    "deleted_at": null,
    "created_at": "2026-10-02T08:12:30+00:00",
    "updated_at": "2026-10-02T08:12:30+00:00"
  }
}

Прочитать подключение

Ответ — это подключение в том же виде, что и в ответе выше.

Terminal
curl https://api.slen.ai/api/v1/provider-connections/74438912450035712 \
  -H "Authorization: Bearer $SLEN_API_KEY"

Заменить ключ

Новый ключ заменяет сохранённый. Подключение в invalid_credentials снова становится active.

Terminal
curl -X PATCH https://api.slen.ai/api/v1/provider-connections/74438912450035712 \
  -H "Authorization: Bearer $SLEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "sk-proj-77b2...e0a4"
  }'

Удалить подключение

У ответа нет тела.

Terminal
curl -X DELETE https://api.slen.ai/api/v1/provider-connections/74438912450035712 \
  -H "Authorization: Bearer $SLEN_API_KEY"

204 No Content

Включить подключение

У запроса нет тела. Ответ — это подключение, у которого status равно active.

Terminal
curl -X POST https://api.slen.ai/api/v1/provider-connections/74438912450035712/enable \
  -H "Authorization: Bearer $SLEN_API_KEY"

Отключить подключение

Ответ — это подключение, у которого status и health_status равны disabled.

Terminal
curl -X POST https://api.slen.ai/api/v1/provider-connections/74438912450035712/disable \
  -H "Authorization: Bearer $SLEN_API_KEY"

Проверить подключение

Провайдер принял ключ и ответил за 184 миллисекунды.

Terminal
curl -X POST https://api.slen.ai/api/v1/provider-connections/74438912450035712/test \
  -H "Authorization: Bearer $SLEN_API_KEY"
200 OK
{
  "data": {
    "ok": true,
    "latency_ms": 184,
    "checked_at": "2026-10-02T08:13:05+00:00",
    "error_code": null,
    "rate_limited": false
  }
}

Прочитать лимиты

Ответ — это список строк в том виде, который показывает следующий пример.

Terminal
curl https://api.slen.ai/api/v1/provider-connections/74438912450035712/limits \
  -H "Authorization: Bearer $SLEN_API_KEY"

Задать лимиты

В первой строке нет model: это значение по умолчанию для подключения. Вторая строка ограничивает одну модель.

Terminal
curl -X PUT https://api.slen.ai/api/v1/provider-connections/74438912450035712/limits \
  -H "Authorization: Bearer $SLEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "limits": [
      {
        "rpm": 500,
        "tpm": 200000,
        "max_concurrency": 20
      },
      {
        "model": "gpt-4o-mini",
        "rpm": 300
      }
    ]
  }'
200 OK
{
  "data": [
    {
      "model": null,
      "rpm": 500,
      "tpm": 200000,
      "input_tpm": null,
      "output_tpm": null,
      "max_concurrency": 20,
      "daily_quota": null,
      "source": "manual"
    },
    {
      "model": "gpt-4o-mini",
      "rpm": 300,
      "tpm": null,
      "input_tpm": null,
      "output_tpm": null,
      "max_concurrency": null,
      "daily_quota": null,
      "source": "manual"
    }
  ]
}

Поставить на паузу

Подключение выведено из работы на десять минут. Без reason пауза — manual.

Terminal
curl https://api.slen.ai/api/v1/provider-connections/74438912450035712/cooldown \
  -H "Authorization: Bearer $SLEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "duration_seconds": 600
  }'
200 OK
{
  "data": {
    "connection_id": "74438912450035712",
    "reason": "manual",
    "source": "manual",
    "starts_at": "2026-10-02T09:00:00+00:00",
    "expires_at": "2026-10-02T09:10:00+00:00",
    "retry_after_seconds": 600
  }
}

Снять с паузы

У ответа нет тела.

Terminal
curl -X DELETE https://api.slen.ai/api/v1/provider-connections/74438912450035712/cooldown \
  -H "Authorization: Bearer $SLEN_API_KEY"

204 No Content

Прочитать, как вело себя подключение

Окно следует правилам отчёта: семь дней без from и to и не больше 31 дня.

Terminal
curl "https://api.slen.ai/api/v1/provider-connections/74438912450035712/analytics?from=2026-09-25T00%3A00%3A00Z&to=2026-10-02T00%3A00%3A00Z" \
  -H "Authorization: Bearer $SLEN_API_KEY"

Что читать дальше

Собрано из openapi b070e1f, sdk contract 5cc7055, php ae4a53b, node 84bc62d