Expand description
tt-preview — pure cost preview engine.
See docs/superpowers/specs/2026-05-28-trackC-cost-preview-api-design.md.
Re-exports§
pub use error::PreviewError;pub use types::CacheProjections;pub use types::CurrentEstimate;pub use types::EstimationConfidence;pub use types::PreviewRequest;pub use types::PreviewResponse;pub use types::QualityRiskBand;pub use types::RouteSuggestion;pub use types::Suggestion;
Modules§
- cache_
projection - Cache hit-rate projection.
- classifier
- Cheap regex-based task classifier. Pattern-matches the last user message
against indicators of: classification, extraction, code, agent, generic chat.
The same patterns inform
output-no-max-tokensInspect rule fix hints. - error
- Preview engine errors. Designed so the HTTP handler can always emit a
valid
PreviewResponsewithwarnings[], never a 5xx. - pricing
- Wrapper over per-provider pricing tables.
- route_
suggestions - Cheaper-equivalent route suggestions.
- token_
estimator - Per-model token estimation.
- types
- Request + response shapes for the preview engine.
Functions§
- preview
- Top-level entry point. Returns a complete
PreviewResponse. The only way this returnsErris if the model is unknown AND the optional fallback heuristic also fails — in practice the handler converts that into a 400 with a clear message.