跳转到内容

控制台 API: admin-channel

本页由 server/api/openapi.yaml 生成,内容为英文,请勿手工修改。

Channels, channel keys, source connectors, offerings. Handlers: internal/admin/channel.

Registered source connectors

operationId adminListSourceKinds · auth: adminSession

Status Meaning Body
200 OK application/json SourceKindList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — SourceKindList

  • data (array of SourceKind, required)
    • kind (string, required)
    • display_name (string, required)
    • protocols (array of UpstreamProtocol, required)
    • secret_fields (array of string, required) — Config properties that are write-only (returned as ********).

GET /api/v1/admin/source-kinds/{kind}/schema

Section titled “GET /api/v1/admin/source-kinds/{kind}/schema”

JSON Schema of a connector’s source_config

operationId adminGetSourceKindSchema · auth: adminSession

The channel form is generated from it.

Parameter In Type Required Description
kind path string yes
protocol query UpstreamProtocol no Narrow the schema to one protocol.
Status Meaning Body
200 OK application/json JSONSchema
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — JSONSchema

A JSON Schema (draft 2020-12) object. Form conventions: title, description, default, enum, format (uri | password | textarea), x-order, x-secret, x-protocols.

List channels

operationId adminListChannels · auth: adminSession

Status Meaning Body
200 OK application/json ChannelList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — ChannelList

  • data (array of Channel, required)
    • name (string, required)
    • provider_tag (string, required) — Label clients may use in routing preferences; several channels may share one.
    • source_kind (string, required)
    • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
    • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
    • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
    • priority (integer, required) — Higher is tried first.
    • weight (integer, required) — Share within a priority.
    • rpm_limit (integer, required, nullable)
    • tpm_limit (integer, required, nullable)
    • concurrency_limit (integer, required, nullable)
    • test_model (string, required)
    • note (string, required)
    • id (string, required)
    • status_reason (string, required)
    • created_at (string, required)
    • updated_at (string, required)

Create a channel

operationId adminCreateChannel · auth: adminSession

Request body (required) application/json — ChannelInput

  • name (string, required)
  • provider_tag (string) — Label clients may use in routing preferences; several channels may share one.
  • source_kind (string, required)
  • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
  • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
  • status (“enabled” | “disabled”) — Operators set enabled or disabled only.
  • priority (integer) — Higher is tried first.
  • weight (integer) — Share within a priority.
  • rpm_limit (integer, nullable)
  • tpm_limit (integer, nullable)
  • concurrency_limit (integer, nullable)
  • test_model (string)
  • note (string)
Status Meaning Body
201 OK application/json Channel
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — Channel

  • name (string, required)
  • provider_tag (string, required) — Label clients may use in routing preferences; several channels may share one.
  • source_kind (string, required)
  • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
  • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
  • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
  • priority (integer, required) — Higher is tried first.
  • weight (integer, required) — Share within a priority.
  • rpm_limit (integer, required, nullable)
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • test_model (string, required)
  • note (string, required)
  • id (string, required)
  • status_reason (string, required)
  • created_at (string, required)
  • updated_at (string, required)

Get a channel

operationId adminGetChannel · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes
Status Meaning Body
200 OK application/json Channel
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Channel

  • name (string, required)
  • provider_tag (string, required) — Label clients may use in routing preferences; several channels may share one.
  • source_kind (string, required)
  • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
  • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
  • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
  • priority (integer, required) — Higher is tried first.
  • weight (integer, required) — Share within a priority.
  • rpm_limit (integer, required, nullable)
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • test_model (string, required)
  • note (string, required)
  • id (string, required)
  • status_reason (string, required)
  • created_at (string, required)
  • updated_at (string, required)

Replace a channel

operationId adminUpdateChannel · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes

Request body (required) application/json — ChannelInput

  • name (string, required)
  • provider_tag (string) — Label clients may use in routing preferences; several channels may share one.
  • source_kind (string, required)
  • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
  • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
  • status (“enabled” | “disabled”) — Operators set enabled or disabled only.
  • priority (integer) — Higher is tried first.
  • weight (integer) — Share within a priority.
  • rpm_limit (integer, nullable)
  • tpm_limit (integer, nullable)
  • concurrency_limit (integer, nullable)
  • test_model (string)
  • note (string)
Status Meaning Body
200 OK application/json Channel
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Channel

  • name (string, required)
  • provider_tag (string, required) — Label clients may use in routing preferences; several channels may share one.
  • source_kind (string, required)
  • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
  • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
  • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
  • priority (integer, required) — Higher is tried first.
  • weight (integer, required) — Share within a priority.
  • rpm_limit (integer, required, nullable)
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • test_model (string, required)
  • note (string, required)
  • id (string, required)
  • status_reason (string, required)
  • created_at (string, required)
  • updated_at (string, required)

DELETE /api/v1/admin/channels/{channel_id}

Section titled “DELETE /api/v1/admin/channels/{channel_id}”

Delete a channel with its keys and offerings

operationId adminDeleteChannel · auth: adminSession

Soft-deletes the channel and its offerings (usage records and price history keep referring to them) and permanently deletes its keys. Never 409; a second call is 404.

Parameter In Type Required Description
channel_id path string<uuid> yes
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

POST /api/v1/admin/channels/{channel_id}/status

Section titled “POST /api/v1/admin/channels/{channel_id}/status”

Enable or disable a channel

operationId adminSetChannelStatus · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes

Request body (required) application/json — SetChannelStatusRequest

  • status (“enabled” | “disabled”, required)
  • reason (string)
Status Meaning Body
200 OK application/json Channel
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Channel

  • name (string, required)
  • provider_tag (string, required) — Label clients may use in routing preferences; several channels may share one.
  • source_kind (string, required)
  • source_config (object, required) — Connector configuration matching the source kind’s JSON Schema. Secret fields come back as ********; sending that placeholder on update keeps the stored value.
  • protocol (UpstreamProtocol, required) — Upstream protocol id. Not a closed set: valid values are the registered protocols (v1: openai_compat, anthropic, gemini), listed per source kind by GET /api/v1/admin/source-kinds. An unknown value is 400 unknown_protocol.
  • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
  • priority (integer, required) — Higher is tried first.
  • weight (integer, required) — Share within a priority.
  • rpm_limit (integer, required, nullable)
  • tpm_limit (integer, required, nullable)
  • concurrency_limit (integer, required, nullable)
  • test_model (string, required)
  • note (string, required)
  • id (string, required)
  • status_reason (string, required)
  • created_at (string, required)
  • updated_at (string, required)

POST /api/v1/admin/channels/{channel_id}/test

Section titled “POST /api/v1/admin/channels/{channel_id}/test”

Send a live test request through a channel

operationId adminTestChannel · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes

Request body application/json — ChannelTestRequest

  • model (string) — Upstream model to call; default the channel’s test_model.
  • channel_key_id (string) — Test one specific key.
Status Meaning Body
200 OK application/json ChannelTestResult
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — ChannelTestResult

  • ok (boolean, required)
  • latency_ms (integer, required)
  • http_status (integer, required)
  • upstream_model (string, required)
  • error_code (string, required)
  • error_message (string, required)
  • response_excerpt (string, required) — First characters of the model’s reply.

GET /api/v1/admin/channels/{channel_id}/keys

Section titled “GET /api/v1/admin/channels/{channel_id}/keys”

List a channel’s keys

operationId adminListChannelKeys · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes
Status Meaning Body
200 OK application/json ChannelKeyList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — ChannelKeyList

  • data (array of ChannelKey, required)
    • id (string, required)
    • channel_id (string, required)
    • label (string, required)
    • secret_hint (string, required) — Last 4 characters.
    • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
    • status_reason (string, required)
    • disabled_until (string, required, nullable)
    • weight (integer, required)
    • last_used_at (string, required, nullable)
    • last_error_at (string, required, nullable)
    • last_error (string, required)
    • created_at (string, required)

POST /api/v1/admin/channels/{channel_id}/keys

Section titled “POST /api/v1/admin/channels/{channel_id}/keys”

Add keys to a channel

operationId adminAddChannelKeys · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes

Request body (required) application/json — AddChannelKeysRequest

  • keys (array of ChannelKeyInput, required, minItems: 1, maxItems: 500)
    • label (string)
    • secret (string, required)
    • weight (integer) — Default 100.
Status Meaning Body
201 OK application/json ChannelKeyList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — ChannelKeyList

  • data (array of ChannelKey, required)
    • id (string, required)
    • channel_id (string, required)
    • label (string, required)
    • secret_hint (string, required) — Last 4 characters.
    • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
    • status_reason (string, required)
    • disabled_until (string, required, nullable)
    • weight (integer, required)
    • last_used_at (string, required, nullable)
    • last_error_at (string, required, nullable)
    • last_error (string, required)
    • created_at (string, required)

POST /api/v1/admin/channels/{channel_id}/keys/{key_id}/status

Section titled “POST /api/v1/admin/channels/{channel_id}/keys/{key_id}/status”

Enable or disable one key

operationId adminSetChannelKeyStatus · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes
key_id path string<uuid> yes

Request body (required) application/json — SetChannelKeyStatusRequest

  • status (“enabled” | “disabled”, required)
  • reason (string)
  • disabled_until (string, nullable) — Re-enable automatically at this time.
Status Meaning Body
200 OK application/json ChannelKey
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — ChannelKey

  • id (string, required)
  • channel_id (string, required)
  • label (string, required)
  • secret_hint (string, required) — Last 4 characters.
  • status (ChannelStatus, required) — auto_disabled is set by the system (circuit breaker, auth failures).
  • status_reason (string, required)
  • disabled_until (string, required, nullable)
  • weight (integer, required)
  • last_used_at (string, required, nullable)
  • last_error_at (string, required, nullable)
  • last_error (string, required)
  • created_at (string, required)

DELETE /api/v1/admin/channels/{channel_id}/keys/{key_id}

Section titled “DELETE /api/v1/admin/channels/{channel_id}/keys/{key_id}”

Delete one key

operationId adminDeleteChannelKey · auth: adminSession

Parameter In Type Required Description
channel_id path string<uuid> yes
key_id path string<uuid> yes
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error

List offerings

operationId adminListOfferings · auth: adminSession

Parameter In Type Required Description
model_id query string<uuid> no
channel_id query string<uuid> no
Status Meaning Body
200 OK application/json OfferingList
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — OfferingList

  • data (array of Offering, required)
    • model_id (string, required)
    • channel_id (string, required)
    • upstream_model (string, required)
    • enabled (boolean, required)
    • priority (integer, required, nullable) — Null = inherit the channel’s.
    • weight (integer, required, nullable) — Null = inherit the channel’s.
    • capabilities (ModelCapabilities)
      • streaming (boolean, required)
      • tools (boolean, required)
      • vision (boolean, required)
      • audio_input (boolean, required)
      • audio_output (boolean, required)
      • documents (boolean, required)
      • reasoning (boolean, required)
      • prompt_caching (boolean, required)
      • structured_output (boolean, required)
      • web_search (boolean, required)
      • builtin_tools (array of string) — Provider-executed tool types other than web search that requests may use (for example code_execution_20250522). An entry ending in * matches by prefix. Empty or absent allows none.
      • service_tiers (array of string) — Non-default service tiers requests may ask for (for example flex, priority). An entry ending in * matches by prefix. Empty or absent allows none.
    • id (string, required)
    • sell_price_version_id (string, required, nullable) — Sell price override; null = model price.
    • cost_price_version_id (string, required, nullable) — What the upstream charges; null = unknown.
    • created_at (string, required)
    • updated_at (string, required)

Create an offering

operationId adminCreateOffering · auth: adminSession

Request body (required) application/json — OfferingInput

  • model_id (string, required)
  • channel_id (string, required)
  • upstream_model (string, required)
  • enabled (boolean)
  • priority (integer, nullable) — Null = inherit the channel’s.
  • weight (integer, nullable) — Null = inherit the channel’s.
  • capabilities (ModelCapabilities)
    • streaming (boolean, required)
    • tools (boolean, required)
    • vision (boolean, required)
    • audio_input (boolean, required)
    • audio_output (boolean, required)
    • documents (boolean, required)
    • reasoning (boolean, required)
    • prompt_caching (boolean, required)
    • structured_output (boolean, required)
    • web_search (boolean, required)
    • builtin_tools (array of string) — Provider-executed tool types other than web search that requests may use (for example code_execution_20250522). An entry ending in * matches by prefix. Empty or absent allows none.
    • service_tiers (array of string) — Non-default service tiers requests may ask for (for example flex, priority). An entry ending in * matches by prefix. Empty or absent allows none.
Status Meaning Body
201 OK application/json Offering
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 201 application/json — Offering

  • model_id (string, required)
  • channel_id (string, required)
  • upstream_model (string, required)
  • enabled (boolean, required)
  • priority (integer, required, nullable) — Null = inherit the channel’s.
  • weight (integer, required, nullable) — Null = inherit the channel’s.
  • capabilities (ModelCapabilities)
    • streaming (boolean, required)
    • tools (boolean, required)
    • vision (boolean, required)
    • audio_input (boolean, required)
    • audio_output (boolean, required)
    • documents (boolean, required)
    • reasoning (boolean, required)
    • prompt_caching (boolean, required)
    • structured_output (boolean, required)
    • web_search (boolean, required)
    • builtin_tools (array of string) — Provider-executed tool types other than web search that requests may use (for example code_execution_20250522). An entry ending in * matches by prefix. Empty or absent allows none.
    • service_tiers (array of string) — Non-default service tiers requests may ask for (for example flex, priority). An entry ending in * matches by prefix. Empty or absent allows none.
  • id (string, required)
  • sell_price_version_id (string, required, nullable) — Sell price override; null = model price.
  • cost_price_version_id (string, required, nullable) — What the upstream charges; null = unknown.
  • created_at (string, required)
  • updated_at (string, required)

Replace an offering

operationId adminUpdateOffering · auth: adminSession

Parameter In Type Required Description
offering_id path string<uuid> yes

Request body (required) application/json — OfferingInput

  • model_id (string, required)
  • channel_id (string, required)
  • upstream_model (string, required)
  • enabled (boolean)
  • priority (integer, nullable) — Null = inherit the channel’s.
  • weight (integer, nullable) — Null = inherit the channel’s.
  • capabilities (ModelCapabilities)
    • streaming (boolean, required)
    • tools (boolean, required)
    • vision (boolean, required)
    • audio_input (boolean, required)
    • audio_output (boolean, required)
    • documents (boolean, required)
    • reasoning (boolean, required)
    • prompt_caching (boolean, required)
    • structured_output (boolean, required)
    • web_search (boolean, required)
    • builtin_tools (array of string) — Provider-executed tool types other than web search that requests may use (for example code_execution_20250522). An entry ending in * matches by prefix. Empty or absent allows none.
    • service_tiers (array of string) — Non-default service tiers requests may ask for (for example flex, priority). An entry ending in * matches by prefix. Empty or absent allows none.
Status Meaning Body
200 OK application/json Offering
default Error envelope. The HTTP status follows the error kind. application/json Error

Response 200 application/json — Offering

  • model_id (string, required)
  • channel_id (string, required)
  • upstream_model (string, required)
  • enabled (boolean, required)
  • priority (integer, required, nullable) — Null = inherit the channel’s.
  • weight (integer, required, nullable) — Null = inherit the channel’s.
  • capabilities (ModelCapabilities)
    • streaming (boolean, required)
    • tools (boolean, required)
    • vision (boolean, required)
    • audio_input (boolean, required)
    • audio_output (boolean, required)
    • documents (boolean, required)
    • reasoning (boolean, required)
    • prompt_caching (boolean, required)
    • structured_output (boolean, required)
    • web_search (boolean, required)
    • builtin_tools (array of string) — Provider-executed tool types other than web search that requests may use (for example code_execution_20250522). An entry ending in * matches by prefix. Empty or absent allows none.
    • service_tiers (array of string) — Non-default service tiers requests may ask for (for example flex, priority). An entry ending in * matches by prefix. Empty or absent allows none.
  • id (string, required)
  • sell_price_version_id (string, required, nullable) — Sell price override; null = model price.
  • cost_price_version_id (string, required, nullable) — What the upstream charges; null = unknown.
  • created_at (string, required)
  • updated_at (string, required)

DELETE /api/v1/admin/offerings/{offering_id}

Section titled “DELETE /api/v1/admin/offerings/{offering_id}”

Delete an offering

operationId adminDeleteOffering · auth: adminSession

Soft-deletes the offering; its price history is kept. The same (model, channel, upstream_model) may be created again as a new offering. Never 409; a second call is 404.

Parameter In Type Required Description
offering_id path string<uuid> yes
Status Meaning Body
204 Done. —
default Error envelope. The HTTP status follows the error kind. application/json Error