Skip to main content

Crate tt_preview

Crate tt_preview 

Source
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-tokens Inspect rule fix hints.
error
Preview engine errors. Designed so the HTTP handler can always emit a valid PreviewResponse with warnings[], 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 returns Err is 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.