from anthropic import Anthropic
import os
client = Anthropic(
base_url="https://api.neosantara.xyz/anthropic",
api_key=os.environ["NEOSANTARA_API_KEY"]
)
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
thinking={
"type": "enabled",
"budget_tokens": 2048
},
messages=[
{"role": "user", "content": "Berapa banyak huruf 'r' dalam kata 'strawberry'?"}
]
)
for block in response.content:
if block.type == "thinking":
print(f"[Proses Pemikiran]:\n{block.thinking}\n")
elif block.type == "text":
print(f"[Jawaban Akhir]:\n{block.text}")