Gateway
Open and frontier models behind one endpoint, each call on the cheapest model that clears the bar
Content checks, search, drafts, metadata and dubs each get a primary model, an escalation and a fallback. Routing by genre and language becomes a rule you can read, price and re-test, not a habit.
One endpoint, every model
- OpenAI-compatible. Change the base URL; existing code and custom GPT prompts keep working.
- Open and frontier together. Open models served by Dvar from India, priced in rupees; frontier models through the same call.
- Routes decided by evals. Each workflow, language or genre goes to the cheapest model that clears its eval. When a new model ships, the eval re-runs and the route changes without a code change.
- Escalation and fallback. Unsure answers go up a tier; a provider outage falls back; search degrades to keyword results instead of failing.
- Every call traced. Cost, latency and errors per call, with personal details masked, feeding the evals and later post-training.
from openai import OpenAI
client = OpenAI(
base_url="https://portal.dvarlabs.ai/v1", # was the provider's URL
api_key=os.environ["DVAR_API_KEY"],
)
client.chat.completions.create(
model="auto", # the gateway picks per workflow
extra_headers={ # routing hints (illustrative)
"X-Dvar-Workflow": "content-checks",
"X-Dvar-Language": "hi", "X-Dvar-Genre": "horror"},
messages=[...],
)The monthly bill, per workflow
List prices times a token shape per call. Volumes and token shapes are written for the demo; type your own. The content-check escalation share comes from the frozen run.
| Workflow | Route | Calls a month | Per call | Frontier only | This setup |
|---|---|---|---|---|---|
Content checks Five checks on every scene of every draft, dub and subtitle file | Primary GLM 5.3 on Dvar · escalate 1% to claude-sonnet-5.5 (Dvar model confidence under 0.7 (share from the run)) · fallback gpt-oss-120b on Dvar | about 2,000 shows × 80 episodes × 25 scenes × 5 passes (drafts, regenerations, dubs) | 650 in · 40 out ₹0.14 frontier ₹0.08 primary | ₹28.6 lakh | ₹16.6 lakh 1.7× lower |
Search query reading Turn a typed query into genre, tags, language and a title guess | Primary gpt-oss-120b on Dvar · fallback keyword results | searches a month that need more than keyword matching (assumed) | 420 in · 45 out ₹0.11 frontier ₹0.0060 primary | ₹32.5 lakh | ₹1.80 lakh 18× lower |
Episode script drafts First drafts of episode scripts from a beat sheet and the show bible | Primary claude-sonnet-5.5 · fallback GLM 5.3 on Dvar | about 2,000 shows × 80 episodes × 2.5 drafts | 3,000 in · 1,200 out ₹1.51 frontier ₹1.51 primary | ₹6.05 lakh | ₹6.05 lakh same |
Titles, synopses, thumbnail and push copy Short marketing text per episode, in several variants | Primary gpt-oss-120b on Dvar · fallback GLM 5.3 on Dvar | 160,000 episodes × 10 variants | 1,200 in · 250 out ₹0.41 frontier ₹0.02 primary | ₹6.59 lakh | ₹35,200 19× lower |
Translation for dubs and subtitles Hindi scripts into other Indian languages and English | Primary GLM 5.3 on Dvar · escalate 10% to claude-sonnet-5.5 (language check fails on the output) · fallback gpt-oss-120b on Dvar | 160,000 episodes × 3 languages | 1,500 in · 1,700 out ₹1.68 frontier ₹0.74 primary | ₹8.06 lakh | ₹4.34 lakh 1.9× lower |
| All workflows | ₹81.8 lakh | ₹29.1 lakh 2.8× lower | |||
Episode drafts stay on frontier here on purpose: the generator gate decides when an open or post-trained model clears the bar for each language and genre, and the route changes then.
A simulated day through the gateway
One day at the default volumes, sampled 1 in 1,000 and scaled back up. Turn on an incident to see where calls go.
| Workflow | Calls | Escalated | Fell back | Degraded | Cost (if frontier only) |
|---|---|---|---|---|---|
| Content checks | 6,64,000 | 7,000 | 0 | 0 | ₹55,348 (₹94,819) |
| Search query reading | 9,97,000 | 0 | 0 | 0 | ₹5,982 (₹1.08 lakh) |
| Episode script drafts | 11,000 | 0 | 0 | 0 | ₹16,632 (₹16,632) |
| Titles, synopses, thumbnail and push copy | 60,000 | 0 | 0 | 0 | ₹1,320 (₹24,696) |
| Translation for dubs and subtitles | 11,000 | 0 | 0 | 0 | ₹8,091 (₹18,480) |
