Claude API: AI by Anthropic
Claude competes strongly with ChatGPT, especially with 200K token context window and superior code analysis.
Python SDK
pip install anthropicimport anthropic, os
client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
msg = client.messages.create(
model="claude-3-5-haiku-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": "Explain the difference between Apache and Nginx."}]
)
print(msg.content[0].text)Tip: Claude 3 Haiku ($0.25/$1.25 per 1M tokens) is ideal for high-volume chatbots.