Expand description
Token cost estimation for AI vision providers.
Both OpenAI and Anthropic charge tokens for image inputs based on image dimensions. This module implements the public token-counting formulas so SHIFT can report estimated savings.
Structs§
- Image
Metrics - Per-image before/after metrics for the report.
- Token
Estimate - Estimated token counts for a single image across providers.
- Token
Savings - Aggregate token savings across all images.
Functions§
- anthropic_
tokens - Anthropic vision token count for standard-resolution models.
- estimate_
tokens - Estimate tokens for an image at given dimensions.
- openai_
tokens - OpenAI vision token count for
detail: high. - openai_
tokens_ low - Fixed token count for OpenAI detail: low.