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

Збережіть 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