/openai/v1, so
the official OpenAI SDKs — and anything that speaks the OpenAI wire format — work unchanged. You
change exactly two things: the base URL and the API key.
By the end you will have the same chat, streaming, embeddings, and image code running through
Roadie, with your provider keys held server-side (BYOK), per-end-user attribution, and request
logs — and you will have confirmed parity against your old OpenAI path.
This is the tutorial version of the OpenAI drop-in quickstart: it
starts from an existing app, walks the switch in both Node and Python, and verifies the result.
Prerequisites
In the dashboard:- Create a project — its
developmentandproductionenvironments are created for you. - Add and validate an OpenAI provider credential (BYOK). See Providers & BYOK. (Add an Anthropic key too if you want to reach Claude through the same client — see step 6.)
- Create a secret key (
rd_sk_…) for the environment you want to call.
1. Where you are today
A typical starting point calls OpenAI directly. The base URL is implicit and the key is an OpenAI key:2. Point the client at Roadie
SetbaseURL to the OpenAI-compatible surface and pass your Roadie secret key. Nothing else in
your call sites changes.
3. Verify a chat completion
Run one non-streaming completion and read the response exactly as before. TheX-Request-Id
response header ties this call to your Roadie logs.
user_42, with the
model served and token counts. That is the parity check: same response shape, plus metering you did
not have before.
How model resolves
The model field accepts three forms:
- A bare OpenAI name like
gpt-4o— resolved toopenai/gpt-4owhen it is in your catalog (OpenAI is the default provider on this surface). - A qualified
provider/modelid likeanthropic/claude-sonnet-5— routes to that provider directly. - A project alias like
smart— a stable name that can fail over across providers. See Models, aliases & fallback.
4. Streaming still works verbatim
Passstream: true and iterate the deltas — no change from OpenAI.
5. Embeddings and images
The same client reaches embeddings and images with no extra setup.Images always come back as
b64_json (never a URL) and n is capped at 1. Both
images.generate and images.edit are supported. Image generation uses your OpenAI
credential (gpt-image-1); there is no separate image key to add.6. Reach Anthropic through the same client
Because a qualifiedprovider/model id routes directly, you can send Claude requests through the
OpenAI SDK — the one thing you could not do talking to OpenAI directly:
7. Errors map to the OpenAI error classes
Roadie returns the OpenAI error envelope, so the OpenAI SDKs deserialize failures into the same typed classes you already catch. The HTTP status the SDK keys on is preserved:On the native surface Roadie distinguishes
quota_error (429) from budget_error (402), but the
OpenAI schema has no 402, so both are reported here as insufficient_quota at 429. See the
error mapping.What you built
You migrated a working OpenAI app onto Roadie by changing only the base URL and the key. You kept your existing SDK, code, and error handling, and you gained: BYOK for OpenAI and Anthropic, per-end-user attribution, usage metering, request logs, and a path to cross-provider fallback — all without a rewrite. Point the client back at OpenAI whenever you like; there is no lock-in.Next steps
Build a Node chat backend
Adopt
@roadie/sdk for typed errors, retries, usage, cost, and requestId.Per-user limits
Now that calls are attributed, give each user their own limits and quotas.
Cross-provider fallback
Fail over from OpenAI to Anthropic behind a single alias.
Observability
Read the usage, cost, and logs your migration just started producing.