# kcode-intelligence-router
A small typed boundary for model-backed work. It is an in-process Rust library,
not an HTTP service.
The complete application-facing surface is:
- `open(Config)` opens configured provider clients and returns the one primary
runtime model description used by Kennedy orchestration.
- `Intelligence::for_user(user_id)` binds required accounting attribution.
- `UserIntelligence::{start_agent_turn,search,transcribe,annotate}` perform
model calls with an exact model ID.
- `UserIntelligence::{transcribe_structured_audio,generate_text}` provide the
structured audio and tool-free text calls needed by background pipelines.
- `UserIntelligence::fetch` fetches one public page.
- `Intelligence::extract_document` performs local document extraction.
- `Intelligence::cancel` stops an operation scope.
- `Intelligence::{receipts,daily_usage}` read the plain usage receipt store.
There is no health API, model catalog, provider selector, JSON dispatcher, or
Axum dependency.
## Usage receipts
Every provider call creates one atomically renamed JSON file in the configured
receipt directory. A receipt contains the user, operation, requested and actual
models, available provider identifiers, and either:
- uncached input, cached input, thinking, and visible output tokens;
- duration metering; or
- an explicit unavailable marker.
`daily_usage` deliberately opens and iterates every receipt. The store has no
folders or indexes until measured performance requires them.
## Media
`Media` carries an explicit `MediaKind`; MIME text does not choose whether
bytes are audio or video. Known Ogg audio is canonicalized to `audio/ogg`, so a
misleading `video/ogg` declaration cannot route an audio object into Gemini's
video constructor.