SDK
Anthropic Python SDK
Use the Anthropic Python SDK with Claude-compatible Messages routes.
Install
pip install anthropicConfigure the client
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["UOUODUO_API_KEY"],
base_url="https://uouo.cloud/v1",
)Messages
message = client.messages.create(
model="claude-3-5-sonnet-latest",
max_tokens=512,
system="You are a careful code review assistant.",
messages=[
{"role": "user", "content": "List three risks in this migration plan."}
],
)
print(message.content)Streaming
with client.messages.stream(
model="claude-3-5-sonnet-latest",
max_tokens=512,
messages=[{"role": "user", "content": "Explain rate-limit handling step by step."}],
) as stream:
for text in stream.text_stream:
print(text, end="")Notes
- `max_tokens` is required.
- `system` is a top-level field, not a message.
- Costs and final token counts are shown in `/app/logs`.