THE COST OF BUILDING WITH AI
Switch from OpenRouter to Tokely
A practical migration checklist: model IDs, base URL, authentication, supported parameters, cost estimates and streaming behavior.
THE SHORT ANSWER
For supported OpenAI-compatible requests, keep the SDK and change the base URL, API key and model ID. Check vendor-specific parameters and model limits before moving traffic. OpenRouter credits and keys do not transfer to Tokely.
1. Check the contract you actually use
Find the exact model in Tokely's catalog. Confirm Chat Completions or Responses support, tools, streaming requirements and output limits. Text endpoints use the documented text contract. OpenRouter provider-routing objects, BYOK and unsupported endpoints cannot be assumed to work.
2. Compare your request's price
Take input/output/cache counts from a representative response and enter them in the cost calculator. Keep the model version fixed. Include your payment fees and any special units separately; a discounted input price alone does not determine the total bill.
3. Create a Tokely key and change the client
Create an account, fund its balance and create an API key in the dashboard. Set credentials through environment variables rather than putting them in source code. This example uses a supported Chat Completions model:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.tokely.me/v1",
api_key=os.environ["TOKELY_API_KEY"],
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Summarize this in one sentence."}],
max_tokens=128,
)
print(response.choices[0].message.content)For a Responses-only model, follow the Responses contract instead: it is stateless, requires supplied history and uses store=false.
4. Verify behavior before routing production traffic
- Check a normal response and the recorded usage for your model.
- Check streaming and stop behavior if your app uses them.
- Check tool definitions/results and finish reasons if applicable.
- Check insufficient-balance, rate-limit and malformed-request behavior.
- Use the returned request ID to find the corresponding dashboard log.
Your application's requests can spend its funded balance. This checklist is a migration procedure, not a claim that a new paid benchmark was run.
5. Move one path and keep rollback simple
Keep the original configuration available and switch one supported request path first. Set an account spending limit and model restrictions where useful. Observe your own application's errors and costs before expanding traffic.
Common differences to account for
Can I keep OpenRouter's provider-routing fields?
No unchanged pass-through is promised. Configure the available Tokely account routing mode and use the supported request parameters.
Does max_tokens change the required balance?
Yes. Tokely reserves against the requested output bound, then settles recorded usage. Set a realistic bound and leave sufficient available balance.
Can I use every OpenAI endpoint?
No. Compatibility covers the published endpoint subset. Embeddings, native Messages and Batch API are not currently offered.
START WITH YOUR OWN WORKLOAD
Know the price.
Then make the call.
Check the model, compare the rate, and connect with a Tokely key.