Skip to main content

Module engine_api

Module engine_api 

Source
Expand description

Engine API — LLM engine introspection + config writes + routing control.

Provides access to the oxi-sdk model catalog (providers, models, search) and write operations that persist to config.toml (model, API key, routing).

Routing statistics (RoutingStats) are shared between this API and AgentRuntime via an Arc, so model usage is recorded end-to-end.

Structs§

EngineApi
Engine API facade — model catalog introspection + config writes + routing.
EngineConfigResponse
Current engine configuration + credential status + routing.
FallbackEvent
Single fallback event record.
ModelInfo
Summary of a model from the catalog.
ProviderInfo
Summary of an LLM provider.
RoutingConfigSnapshot
Snapshot of routing configuration (read-only API response).
RoutingStats
In-memory routing statistics, shared between EngineApi and AgentRuntime. Uses simple RwLock for thread-safe reads/writes.
RoutingStatsSnapshot
Model usage statistics.
RoutingUpdate
Request body for PUT /api/engine/routing.
ValidateKeyResult
Result of an API key validation attempt.

Enums§

InputModality
Input modality for a model.
ProviderCategory
Provider category for UI grouping.

Functions§

estimate_cost
Estimate cost in USD for a model given token usage. Uses oxi-sdk’s model_db for per-model pricing.
record_usage_to_stats