byokey_proxy/openapi.rs
1//! `OpenAPI` specification aggregation.
2//!
3//! Only the OpenAI/Anthropic-compatible REST endpoints are documented here.
4//! The local management API is served over `ConnectRPC` (see
5//! [`crate::handler::management`] and `byokey_proto`); protobuf schemas are
6//! the source of truth for those messages.
7
8use utoipa::OpenApi;
9
10#[derive(OpenApi)]
11#[openapi(
12 paths(
13 crate::handler::models::list_models,
14 ),
15 components(schemas(
16 crate::handler::models::ModelsResponse,
17 crate::handler::models::ModelEntry,
18 )),
19 tags((name = "api", description = "OpenAI / Anthropic compatible REST API"))
20)]
21pub struct ApiDoc;
22
23/// Returns the `OpenAPI` specification as JSON.
24pub async fn openapi_json() -> axum::Json<utoipa::openapi::OpenApi> {
25 axum::Json(ApiDoc::openapi())
26}