Dual-compatible AI gateway supporting both Anthropic Messages API and OpenAI Chat Completions API with streaming, multi-key load balancing, and resilient failover.
from openai import OpenAI
client = OpenAI(
base_url="https://agentapi.byzar.cyou/v1",
api_key="adminuse"
)
stream = client.chat.completions.create(
model="claude-sonnet-4-5",
messages=[
{"role": "system", "content": "You are a master software architect."},
{"role": "user", "content": "Explain reactive concurrency in systems engineering."}
],
stream=True
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
import anthropic
client = anthropic.Anthropic(
base_url="https://agentapi.byzar.cyou",
api_key="adminuse"
)
with client.messages.stream(
model="claude-sonnet-4-5",
max_tokens=4096,
messages=[
{"role": "user", "content": "Who are you and who developed you?"}
]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
{
"mcpServers": {},
"env": {
"ANTHROPIC_BASE_URL": "https://agentapi.byzar.cyou",
"ANTHROPIC_API_KEY": "adminuse"
}
}
adminuse and receive real-time streaming tokens: