Migrate from the OpenAI API to TokenRex

Move an existing OpenAI SDK app to TokenRex in two lines and gain Claude and Gemini models.

Steps

What to check after switching

Example

from openai import OpenAI

client = OpenAI(api_key="YOUR_TOKENREX_KEY", base_url="https://tokenrex.ai/api/public")

resp = client.chat.completions.create(
    model="gpt-6-astra",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
Get API keyCost calculatorDocs

Questions

Can I switch back?
Yes. Nothing is locked in: change the base URL and key back and your code keeps working.

Related