OpenAI SDK, India endpoint
Use the official OpenAI SDK with unoblox's India gateway — same code, 40+ models, streaming and tools, billed monthly in rupees with GST.
The OpenAI SDK is everywhere (Python, Node.js, Go, Java). unoblox replaces OpenAI with a simple two-line config swap: one endpoint, one key, one ₹ invoice. No code rewrite.
Why OpenAI SDK + unoblox
- Tiny change: only
api_key+base_urldiffer - No SDK fork: you use the official OpenAI SDK
- All features: streaming, tools, JSON mode, vision — all pass-through
- 40+ models: all via one endpoint
- ₹ billing: monthly GST invoice from India
Python setup (2 lines)
from openai import OpenAI
# Two config lines
client = OpenAI(
api_key="ub-gw-YOUR_API_KEY",
base_url="https://api.unoblox.ai/v1"
)
# Now use it normally
response = client.chat.completions.create(
model="openai/gpt-4o", # Or any unoblox model
messages=[
{"role": "user", "content": "Explain RAG in 2 sentences."}
]
)
print(response.choices[0].message.content)
Node.js setup (2 lines)
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.UNOBLOX_API_KEY,
baseURL: 'https://api.unoblox.ai/v1'
});
const message = await client.chat.completions.create({
model: 'openai/gpt-4o',
messages: [{ role: 'user', content: 'Say hello in Hindi.' }]
});
console.log(message.choices[0].message.content);
Streaming example (Python)
stream = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "Write a haiku."}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Tool use (JSON mode)
response = client.chat.completions.create(
model="openai/gpt-4o",
messages=[{"role": "user", "content": "What's the weather?"}],
tools=[
{
"type": "function",
"function": {
"name": "get_weather",
"parameters": {"type": "object", "properties": {}}
}
}
]
)
print(response.choices[0].message.tool_calls)
Model pricing (same endpoint)
| Model | ₹ input | ₹ output | Use case |
|---|---|---|---|
| Qwen3 1.7B | FREE | FREE | agents, prototyping |
| DeepSeek V4 Flash | ₹9.07 | ₹18.14 | budget inference |
| GPT-4o | ₹252 | ₹1008 | complex tasks |
| Claude Opus | ₹504 | ₹2520 | reasoning |
Frequently asked questions
Can I keep my existing OpenAI code?
Yes. Only change api_key and base_url. Everything else — method calls, parameter names — stays the same.
Does every OpenAI feature work with unoblox?
Most do. Check model pages in /models for per-model feature support — some models lack vision or tools.
How do I switch models at runtime?
Just change the model parameter in each .create() call. No client reconfiguration needed.
What if I need to fall back to OpenAI?
Swap api_key and base_url in your config (env vars help here). No code change, just a runtime config switch.
Does async work?
Yes. Use AsyncOpenAI instead of OpenAI, then await calls inside async functions — including with stream=True for async streaming.
Can I batch requests? unoblox doesn't offer an OpenAI-style batch endpoint yet. Loop individual requests instead — each is billed at the normal per-token rate.
Get started in rupees → https://unoblox.ai/sign-in
Start building in rupees
Call every major model through one OpenAI-compatible endpoint, billed in ₹ on a GST invoice.