Repository navigation
feat(ai): credit reporting and optional provider wrappers (KTN-201) - #9
backtrack5r3 (tomflenner) wants to merge 8 commits into
Conversation
Signed-off-by: tomflenner <flennertom@gmail.com>
Signed-off-by: tomflenner <flennertom@gmail.com>
Signed-off-by: tomflenner <flennertom@gmail.com>
Signed-off-by: tomflenner <flennertom@gmail.com>
Signed-off-by: tomflenner <flennertom@gmail.com>
Signed-off-by: tomflenner <flennertom@gmail.com>
|
Naming refactor: high-level AI helpers/meters and OpenAI/Anthropic wrappers now use |
Signed-off-by: tomflenner <flennertom@gmail.com>
Signed-off-by: tomflenner <flennertom@gmail.com>
Dedicated AI change and billing dependencyThis PR remains dedicated to the AI credit control plane; AI fixes have been published here, not on the billing branch. It depends on billing PR #5 and should land after billing. The AI and billing branches diverge in generated contracts and shared transaction-error definitions. A base-only retarget would be misleading. Integrate billing's merged base before merging this PR, retaining one shared error class and preserving numeric report versus AI-phase replay semantics. No force-push was performed. Latest verification: 541 focused tests and Ruff passed, including inherited-header suppression and exact usage validation. Earlier broader verification had optional-provider skips and one missing-OpenFeature failure; final full-suite/mypy and typed contract refresh remain incomplete. |
What does this PR change?
KTN-201 generated write-only AI union and response models, reserve/commit/run helpers, typed errors/keyed retries, model and conversion-rule management, inference/reservation reads, optional OpenAI/Anthropic drop-in/delegation wrappers with sync/async streaming settlement. Adds extras, CI compatibility checks, changelog and version 1.1.0.
Testing
Integrated full suite: 948 passed, 8 optional provider compatibility tests skipped because provider packages absent in main environment. Isolated provider-compatible focused suite previously passed with real installed SDK types and synthetic transports. Ruff, mypy (76 files), model/sync generation freshness and targeted contract tests passed.
Compatibility / migration impact
Vendored contract from companion Kaiten feature branch; source.yaml records source commit. Strict read union remains non-AI. AI handwritten response classes replaced with compatibility aliases. Providers are optional extras, no prompts sent to Kaiten.
Decisions to review
NOT_SENT requires demonstrable pre-send failures; ambiguous post-send errors remain provider errors. Usage extraction/validation failures preserve provider results and attempt settlement without usage. Agent interfaces do not establish awaited veto-capable preflight before every internal model inference; full agent wrappers were not fabricated. This is an explicit scope gap pending API/requirements decision.
Not in this PR
Provider proxy/server pricing, universal agent preflight, tags/publication.
Checklist