The 5-Minute Migration: Swapping Your OpenAI Base URL to OpenDunes
Migrating your application's AI gateway doesn't require rebuilding your architecture. Swapping base URLs and API keys takes minutes.
- Published
- June 19, 2026
- Reading
- 2 min read
- Code in
- Python · TypeScript · Env · JSON
4 snippets
When you hear about switching your application's infrastructure to a local, Law 18-07 compliant gateway, you probably expect the worst: weeks of code refactoring, learning a new proprietary SDK, dealing with undocumented endpoints, and fixing integration bugs.
For developers and engineering leads, code stability is paramount. You cannot afford to halt your development pipeline to restructure your AI integrations.
Fortunately, you do not have to.
OpenDunes is built on Bifrost OSS, a high-performance proxy architecture that maintains absolute parity with the standard OpenAI and OpenRouter API specifications. To migrate your application, swap your payment headaches for Dinars, and secure compliance, you only need to change two variables in your codebase.
Here is a step-by-step developer guide to configuring the OpenDunes API proxy (openai api proxy).
The Drop-In Replacement Mechanics
The OpenDunes gateway mirrors the standard OpenAI request and response JSON schemas exactly. When your backend dispatches a payload to our endpoints, we handle auth verification, DZD wallet balance checks, and compliance filters before routing the request upstream. The response is returned to your app in the exact format your existing code expects.
To migrate, you only need to modify:
- The Base URL Endpoint: Route requests to our local gateway.
- The API Authorization Key: Replace your OpenAI bearer token with your Dinar-funded OpenDunes key.
1. Python Integration Example
If your backend is built on Django, FastAPI, or Flask, here is how to swap the configuration using the official openai Python library: