Use the OpenAI SDK with a Third-Party Gateway: Just Change base_url

## The one change that matters
The OpenAI SDK lets you override the API host. That single setting is all you need to route requests through ClaudeN AI while keeping every other line of your code intact.
## Python
``python`
from openai import OpenAI
client = OpenAI(
api_key="YOUR_CLAUDEN_KEY",
base_url="https://clauden.ai/v1",
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Say hi in one line."}],
)
print(resp.choices[0].message.content)
`
## Node.js
javascript`
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.CLAUDEN_KEY,
baseURL: "https://clauden.ai/v1",
});
const resp = await client.chat.completions.create({
model: "claude-3-5-sonnet",
messages: [{ role: "user", content: "Say hi in one line." }],
});
console.log(resp.choices[0].message.content);
OPENAI_BASE_URL
## Environment variable trick
Most tools read (or OPENAI_API_BASE). Set it once and many CLIs and libraries just work:`
bash`
export OPENAI_API_KEY="YOUR_CLAUDEN_KEY"
export OPENAI_BASE_URL="https://clauden.ai/v1"
model`.
## What you get
- Keep your existing SDK, types, and retry logic.
- Switch between Claude, GPT and Gemini by changing
- One key, one balance, one usage log.
Change the base URL, run your code, and you are done.