feat: Anthropic provider/inbound + embeddings

- Anthropic outbound provider: /v1/messages, system extraction, x-api-key +
  anthropic-version; streaming translates Anthropic SSE -> unified OpenAI wire format
- Anthropic inbound adapter (POST /v1/messages): non-streaming JSON + streaming SSE
  (OpenAI -> Anthropic event translation)
- Embeddings: POST /v1/embeddings inbound + Provider::embed(); embedding models
  resolvable from the pool (registry no longer skips them)
- protocols mounted always, gated on live flags; admin meta marks them implemented
This commit is contained in:
infosave2007
2026-06-30 16:50:22 +03:00
parent 70d8cde258
commit bf8534f13d
9 changed files with 528 additions and 24 deletions
+7 -4
View File
@@ -1,7 +1,9 @@
//! Incoming protocol adapters. Each one builds its own axum routes and translates
//! its protocol to/from the canonical model. Enabled via flags in `[protocols]`.
pub mod anthropic_messages;
pub mod openai_chat;
pub mod openai_embeddings;
use crate::state::SharedState;
use axum::Router;
@@ -10,8 +12,9 @@ use axum::Router;
/// each handler checks the live `protocols.*` flag from config itself, so
/// toggles in the admin panel take effect without a restart (hot switching).
pub fn build_router() -> Router<SharedState> {
Router::new().merge(openai_chat::routes())
// TODO: openai_completions, openai_embeddings, openai_models,
// anthropic_messages, mcp, native_passthrough — add here as well,
// with a check of the corresponding flag inside the handler.
Router::new()
.merge(openai_chat::routes())
.merge(openai_embeddings::routes())
.merge(anthropic_messages::routes())
// TODO: openai_completions, openai_models, mcp, native_passthrough.
}