Sync a voice

russ@signalint.net · all

Two lines point your OpenAI SDK at every model

Tue Sep 01, 2026 · 12:42 AM EDT

From
OpenRouter Team <welcome@openrouter.ai>
To
russ@signalint.net

Change the base URL and the key. Streaming, tool calls, and response handling keep working.

OpenRouter ( openrouter.ai?utm_medium=email&utm_source=customerio )

Hi Russell,

******************************************
Your OpenAI SDK already speaks OpenRouter.
******************************************

If your code is built on the OpenAI SDK, reaching the whole catalog is not a rewrite. Point the base URL at OpenRouter, swap in your OpenRouter key, and the same client object reaches every major model. Your streaming, tool calls, and response handling keep working as written.

Open the quickstart ( openrouter.ai/docs/quickstart?utm_camp…customerio )

The whole migration

from openai import OpenAI

client = OpenAI
( base_url="openrouter.ai/api/v1",
api_key="<OPENROUTER_API_KEY>", )

completion = client.chat.completions.create
( extra_headers={
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on openrouter.ai.
"X-OpenRouter-Title": "<YOUR_SITE_NAME>", # Optional. Site title for rankings on openrouter.ai.
},
model="~openai/gpt-latest",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
] )

print(completion.choices[0].message.content)

What carries over

Your code structure

The SDK is a drop-in replacement. Streaming and tool calls run through the same client, and responses come back in the shape your code already parses.

Model choice becomes a string

Any slug from the catalog ( openrouter.ai/models?utm_campaign=onb-…customerio ) drops into the model field. Trying a different lab no longer means a different SDK.

Attribution stays optional

The two extra headers put your app on the public rankings ( openrouter.ai/rankings?utm_campaign=on…customerio ). Leave them out and everything still works.

Building fresh instead of migrating? The native client SDKs ( openrouter.ai/docs/client-sdks/overvie…customerio ) wrap the same API with full type safety and zero boilerplate.

openrouter.ai ( openrouter.ai?utm_medium=email&utm_source=customerio )·Discord ( discord.gg/openrouter?utm_medium=email…customerio )·X ( x.com/openrouter?utm_medium=email&utm_…customerio )·Docs ( openrouter.ai/docs?utm_medium=email&ut…customerio )

169 Madison Avenue, New York, NY 10016

Manage preferences ( track.customer.io/manage_subscription_…ze8gff6w== )|Unsubscribe ( track.customer.io/unsubscribe/dgSE_QoL…ze8gff6w== )