Connect SDKs and tools
How to connect to OpenAI SDK, Anthropic SDK, and Claude Code
OpenAI SDK
It’s just a matter of changing the address and key values. It’s the same for both Python and JavaScript.
from openai import OpenAI
client = OpenAI(
base_url="https://alprouter.com/api/v1",
api_key="alp-your-key",
)
answer = client.chat.completions.create(
model="anthropic/claude-opus-5.5",
messages=[{"role": "user", "content": "Hello"}],
)
print(answer.choices[0].message.content)Anthropic SDK
The Claude model can also be used with the Anthropic SDK. The only difference is that the address doesn’t end with “/v1”. For more details, please refer to Messages API.
import anthropic
client = anthropic.Anthropic(
base_url="https://alprouter.com/api",
api_key="alp-your-key",
)
message = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(message.content[0].text)Claude Code
It’s connected to two environmental variables. The method is located in Connect Claude Code.
Other tools/equipment
If it’s a tool that can receive OpenAI-compatible addresses, then you just need to fill in the base URL with https://alprouter.com/api/v1, the AlpRouter key in the key field, and the name of the model in Model Screen.
If your tool uses the OpenAI Responses format (/responses), see Responses API. For Codex, see Connect Codex.
If you have any tools that don’t work properly, please let us know by sending an email to help@alpsoft.io.