Intermediate8 min
Provider Extras & Advanced Tools
The extras attribute (v1.2), Anthropic programmatic tool calling, OpenAI strict schemas, and advanced tool patterns.
Quick Reference
- →extras attribute (v1.2) exposes provider-specific features without breaking the unified API
- →Anthropic: cache_control, tool_choice='any', thinking={type, budget_tokens}
- →OpenAI: strict=True on bind_tools(), parallel_tool_calls=False, seed for determinism
- →Gemini: thinking_budget, include_thoughts=True, safety_settings per harm category
- →Use extras sparingly — they tie your code to a specific provider
Provider Extras at a Glance
| Provider | Extra | What it does |
|---|---|---|
| Anthropic | cache_control | Cache tool definitions or messages to reduce cost and latency on repeated calls |
| Anthropic | tool_choice | Force the model to always call a specific tool, or disable tool calling entirely |
| Anthropic | extended thinking | Let Claude reason internally before responding — improves complex problem solving |
| Anthropic | bash / text editor tools | Native Claude tools for running shell commands and editing files |
| OpenAI | strict: True | Guarantee the model's output matches your schema exactly — no hallucinated or missing fields |
| OpenAI | parallel_tool_calls | Control whether the model can call multiple tools at the same time |
| OpenAI | seed | Get deterministic outputs for the same input — useful for testing |
| Gemini | safety_settings | Adjust content safety thresholds per category |
| Gemini | thinking_config | Enable extended thinking on Gemini 2.5 models |
| Gemini | context_cache | Cache large content (documents, long prompts) across requests to save tokens |