Python SDK
Use the official anthropic and openai packages with evolved.to.
Use Anthropic's anthropic package for Claude models and OpenAI's openai package for GPT models. Both only need a different base URL and your evolved.to key.
Install
pip install anthropic openaiClaude models
Set base_url to https://api.evolved.to, without /v1.
import os
import anthropic
client = anthropic.Anthropic(
base_url="https://api.evolved.to",
api_key=os.environ["EVOLVED_API_KEY"],
)
message = client.messages.create(
model="claude-opus-5",
max_tokens=16000,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
for block in message.content:
if block.type == "text":
print(block.text)GPT models
Set base_url to https://api.evolved.to/v1. The Responses API is shown; client.chat.completions.create works too, with every model.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.evolved.to/v1",
api_key=os.environ["EVOLVED_API_KEY"],
)
response = client.responses.create(
model="gpt-5",
input="Hello!",
)
print(response.output_text)Streaming
Stream long outputs to show progress and avoid timeouts.
import os
import anthropic
client = anthropic.Anthropic(
base_url="https://api.evolved.to",
api_key=os.environ["EVOLVED_API_KEY"],
)
with client.messages.stream(
model="claude-opus-5",
max_tokens=64000,
messages=[{"role": "user", "content": "Write a haiku about gateways."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)import os
from openai import OpenAI
client = OpenAI(base_url="https://api.evolved.to/v1", api_key=os.environ["EVOLVED_API_KEY"])
stream = client.responses.create(
model="gpt-5",
input="Write a haiku about gateways.",
stream=True,
)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)Errors raise the SDKs' usual exception types; see Error codes for what each one means.