Cap the cost of any single LLM request at $1. TealEngine estimates the cost before execution based on input token count and model pricing, denying requests that would exceed the limit.
Policy JSON
What It Does
- Estimates request cost before sending to the LLM based on input tokens, expected output tokens, and model pricing
- Denies requests where the estimated cost exceeds $1.00
- Pre-execution estimation prevents expensive calls from ever reaching the provider
- Works with all 7 supported providers (OpenAI, Anthropic, Gemini, Bedrock, Azure OpenAI, Cohere, Mistral)
Example
Agent sends a 50,000-token prompt to GPT-4o:
Decision object:
Install
Customize
Cost estimation is based on input token count and model pricing tables. Actual costs may vary slightly due to output token variability. Set your limit with a small buffer to account for estimation variance.