Python AI API Quickstart
for Algerian Developers
Use the official openai Python library to access 60+ AI models from Algeria. Pay in Algerian Dinar. No VPN, no custom SDK, no foreign card — ready in under 5 minutes.
Key Features
Zero Custom SDK
pip install openai. That is it. DZRouter is 100% OpenAI-compatible — no special library, no adapter, no wrapper.
60+ Models, One Key
ChatGPT, Claude, Gemini, DeepSeek, Mistral — switch with a single string change. One API key, one base_url.
Works with LangChain
ChatOpenAI, llama-index, litellm — any Python AI framework that accepts a custom base_url works out of the box.
Install
DZRouter uses the official OpenAI Python SDK. No custom package needed.
pip install openaiQuickstart — 5 Lines of Python
This is everything you need. Change base_url and api_key — the rest of your existing code works unchanged.
import openai
client = openai.OpenAI(
base_url="https://api.dzrouter.tech/v1",
api_key="dzr-your-api-key" # from DZRouter Dashboard
)
response = client.chat.completions.create(
model="anthropic/claude-4.6", # or openai/gpt-4o, google/gemini-2.5-pro, etc.
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)Switch Models — Zero Code Changes
DZRouter gives you access to 60+ models through a single endpoint. To switch models, change one string. Nothing else changes — same SDK, same parameters, same response format.
# Switch between any of these — same code, different model string:
model="openai/gpt-4o" # OpenAI GPT-4o
model="anthropic/claude-4.6" # Anthropic Claude 4.6
model="deepseek/deepseek-v4" # DeepSeek V4 (cost-effective)View all 60+ available model slugs in the DZRouter dashboard after joining the waitlist.
Streaming Example
Streaming works identically to the OpenAI SDK — no changes needed beyond the base URL.
for chunk in client.chat.completions.create(
model="anthropic/claude-4.6",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
):
print(chunk.choices[0].delta.content or "", end="", flush=True)LangChain Integration
Already using LangChain? Pass DZRouter as the base URL to ChatOpenAI. Works with chains, agents, and RAG pipelines without modification.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.dzrouter.tech/v1",
api_key="dzr-...",
model="anthropic/claude-4.6"
)
# Use in any LangChain chain, agent, or RAG pipeline
response = llm.invoke("What is the capital of Algeria?")Get Started in 3 Steps
- 01
Join the Waitlist
Sign up on dzrouter.tech. Select Personal or Business. We send you your API key the moment we launch — free to join, no credit card needed to sign up.
- 02
Top Up Your Wallet in DZD
Add credit using Edahabia (BaridiMob), CIB bank card, CCP (La Poste), Chargily Pay, Wimpay, or direct bank transfer. All payments are in Algerian Dinar — no foreign accounts needed.
- 03
Run pip install openai and Copy the Quickstart
Set base_url to https://api.dzrouter.tech/v1, replace your API key, and call any of 60+ models. Your existing Python code needs zero other changes.
Frequently Asked Questions
- Do I need a special SDK to use DZRouter in Python?
- No. DZRouter is 100% OpenAI-compatible. Run pip install openai and point base_url to https://api.dzrouter.tech/v1. No custom SDK, no extra dependencies.
- How do I switch from OpenAI to DZRouter in my Python code?
- Change base_url to https://api.dzrouter.tech/v1 and replace your OpenAI key with your DZRouter API key. That is a one-line change. Everything else — models, parameters, streaming — stays identical.
- Which Python AI libraries work with DZRouter?
- Any library that accepts a custom base_url works with DZRouter: openai, langchain (ChatOpenAI), llama-index, litellm, and others. DZRouter exposes a standard OpenAI-compatible REST API.
- Can I use async Python with DZRouter?
- Yes. Use openai.AsyncOpenAI with the same base_url and api_key. All async methods (acreate, astream) work identically.
- Do I need a VPN to call the DZRouter API from Algeria?
- No. DZRouter's API endpoint at api.dzrouter.tech is accessible from Algeria without any VPN. Our servers are in Europe and the connection is never blocked locally.
Related Guides
Ready to build with AI in Algeria?
Join the waitlist. Get your API key. Run the quickstart. Pay in Dinar.
Join DZRouter Waitlist