# Model APIs: Anthropic-compatible endpoint (beta) at inference.baseten.co
import os
import anthropic
api_key = os.environ["BASETEN_API_KEY"]
client = anthropic.Anthropic(
base_url="https://inference.baseten.co",
api_key=api_key,
default_headers={"Authorization": f"Bearer {api_key}"},
)
with client.messages.stream(
model="deepseek-ai/DeepSeek-V4-Pro",
max_tokens=4096,
messages=[{"role": "user", "content": "Write a haiku about the ocean."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)