predict_cost
Predict the real cost of an LLM call from your actual prompt text — no need to know token counts in advance. Counts tokens locally, infers the task type (or accepts one explicitly), estimates output length from empirical I/O profiles, and returns all models ranked cheapest-first with effective cost after prompt-cache savings. Also surfaces the best quality-per-dollar pick. Use this before making any LLM API call to avoid surprise bills.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top_n | No | Number of models to return, ranked cheapest-first (default: 10, max: 50) | |
| prompt | Yes | The actual prompt text to cost-estimate (required) | |
| task_type | No | Task type for output-length estimation. Auto-inferred from prompt if omitted. Options: classification, extraction, summarization, qa, code_generation, translation, chat, content_generation, reasoning, function_calling, data_analysis, rewrite | |
| require_vision | No | Only include models that support image/vision input (default: false) | |
| cache_hit_ratio | No | Fraction of calls that hit the prompt cache (0–1). Set this if you have a large reusable system prompt. Supported providers: Anthropic (10% cache rate), OpenAI (50%), Google (25%). Default: 0 | |
| min_context_tokens | No | Minimum context window size required in tokens (optional) | |
| require_function_calling | No | Only include models that support function/tool calling (default: false) |