Claude extended thinking pricing
Quick answer
The Claude extended thinking models are priced based on token usage, typically with a higher per-token cost than standard Claude models due to their advanced reasoning capabilities. Pricing details are available on Anthropic's official site and usually involve separate rates for prompt and completion tokens.
PREREQUISITES
Python 3.8+Anthropic API keypip install anthropic>=0.20
Setup
Install the anthropic Python SDK and set your API key as an environment variable to access Claude extended thinking models.
pip install anthropic>=0.20 Step by step
Use the claude-3-5-sonnet-20241022 or similar extended thinking model with the Anthropic SDK to run reasoning tasks. Pricing is based on tokens consumed in prompt and completion.
import os
import anthropic
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=512,
system="You are a helpful assistant.",
messages=[{"role": "user", "content": "Explain the pricing model for Claude extended thinking."}]
)
print(response.content) output
The Claude extended thinking models charge per token used in both prompts and completions, with rates higher than standard Claude models due to enhanced reasoning capabilities.
Common variations
You can adjust max_tokens or switch to smaller Claude models like claude-sonnet-4-5 for cost efficiency. Async calls and streaming are supported but do not affect pricing structure.
import asyncio
import anthropic
async def async_call():
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
response = await client.messages.acreate(
model="claude-3-5-sonnet-20241022",
max_tokens=256,
system="You are a helpful assistant.",
messages=[{"role": "user", "content": "What affects Claude extended thinking pricing?"}]
)
print(response.content)
asyncio.run(async_call()) output
Pricing depends on token usage; extended thinking models cost more per token than base Claude models.
Troubleshooting
If you encounter quota errors or unexpected costs, verify your token usage and model selection. Use Anthropic's dashboard to monitor usage and set limits to control expenses.
Key Takeaways
- Claude extended thinking models charge per token with higher rates than standard Claude models.
- Use Anthropic's SDK with environment API keys to access these models programmatically.
- Adjust token limits and model choice to balance cost and reasoning power.
- Monitor usage on Anthropic's dashboard to avoid unexpected charges.