Code Examples
Provider migration
Switching to Orqen is a 2-line change. Your native SDK format — Anthropic Messages, Bedrock Converse, or OpenAI Chat Completions — works as-is. There is no need to adapt your tool shapes or message format.
Your provider credentials stay in the Orqen dashboard. For Bedrock, Orqen extracts your Orqen key from the standard SigV4 Credential header that boto3 sends automatically.
Anthropic SDK
import anthropic
# Before — direct to Anthropic
# client = anthropic.Anthropic(api_key="sk-ant-...")
# After — point the client at Orqen
client = anthropic.Anthropic(
api_key="sk-orq-YOUR_KEY", # Your Orqen key
base_url="https://api.orqen.app", # No /v1 suffix for Anthropic SDK
)
# Unchanged — your tools stay in Anthropic input_schema format
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Weather in London?"}],
tools=[
{
"name": "get_weather",
"description": "Get current weather for a city.",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
}
],
)
# tool_use, tool_result, streaming — all unchangedWhat Orqen does with your request
Regardless of which SDK you use, Orqen runs the same pipeline on every request:
| Step | What happens | Visible to you |
|---|---|---|
| Translate | Wire format → internal | Anthropic, OpenAI, or Bedrock shape is normalised internally. |
| Optimize | Route tools and clean context | Only the relevant tool subset and cleaner agent context are forwarded to the LLM. |
| Route | Pick provider + model | orqen/auto picks the best model; explicit models pass through. |
| Forward | Call your provider | Uses the credentials you stored in the dashboard. |
| Translate back | Internal → wire format | Response is returned in the same SDK format you sent. |
Your tool format is preserved
Anthropic input_schema, Bedrock toolSpec, and OpenAI function.parameters all reach Orqen in their native shape. You never need to convert between formats. See the API reference for endpoint details.