Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create an Anthropic Claude language model
def anthropic(model_id: str) -> LanguageModel
LanguageModel
ANTHROPIC_API_KEY
export ANTHROPIC_API_KEY="sk-ant-..."
claude-4-5-opus-20251101
claude-4-5-sonnet-20250929
claude-4-5-haiku-20251001
claude-4-opus-20250514
claude-4-sonnet-20250514
claude-3-5-sonnet-latest
claude-3-5-haiku-latest
from ai_query import generate_text from ai_query.providers import anthropic result = await generate_text( model=anthropic("claude-4-5-sonnet-20250929"), prompt="Hello, world!" )
result = await generate_text( model=anthropic("claude-4-5-sonnet-20250929"), prompt="Be creative.", provider_options={ "anthropic": { "temperature": 0.7, "max_tokens": 2000, "top_p": 0.9 } } )
Was this page helpful?