PulseAugur
EN
LIVE 17:48:51
中文(ZH) 用 200 行 Python 搭一个 OpenAI 兼容网关(双上游自动容灾)

Developer builds 200-line Python gateway for OpenAI-compatible LLM failover

A developer has created a roughly 200-line Python application using FastAPI to act as an OpenAI-compatible gateway. This gateway automatically fails over between two LLM providers, DeepSeek and Qwen, if the primary provider experiences timeouts or errors. The system logs usage and quotas to a local SQLite database and handles streaming responses to prevent data truncation during failover. The developer also offers this service commercially through keheai.com. AI

IMPACT Provides a solution for developers to ensure consistent access to LLM services by mitigating single-provider failures.

RANK_REASON Developer-built tool for managing LLM API reliability.

Read on dev.to — LLM tag →

AI-generated summary · Google Gemini · from 2 sources. How we write summaries →

Developer builds 200-line Python gateway for OpenAI-compatible LLM failover

How we ranked this

Signal score
35 / 100
Composite score across the factors below. Higher = stronger signal that this story matters right now.
Newsworthiness bucket
Tool
Developer-built tool for managing LLM API reliability.
Source corroboration
2 independent sources
Multiple independent publishers reporting the same story raises confidence that it's real and newsworthy.
Topics
infra, product
Editorial topic classification. Feeds into how the story surfaces on /topic/<slug> hub pages and into the per-entity coverage mix.
AI-industry relevance
High
Clearly on-topic for AI-industry coverage.
Story freshness
Breaking (< 6h)
Fresh story with cross-source coverage still developing. Ranking may shift as more sources report.

Full methodology in our editorial standards.

COVERAGE [2]

  1. dev.to — LLM tag TIER_1 English(EN) · Harvey He ·

    I built a 200-line OpenAI-compatible gateway with automatic dual-upstream failover

    <p>Last week DeepSeek's API went flaky for ~20 minutes at 3am and my batch job went red. That was the last straw — I stopped trusting a single provider.</p> <p>If you call DeepSeek or Qwen through the OpenAI SDK, the cheapest failover isn't rewriting your app. It's putting an Ope…

  2. dev.to — LLM tag TIER_1 中文(ZH) · Harvey He ·

    Build an OpenAI-Compatible Gateway with 200 Lines of Python (Automatic Failover with Dual Upstreams)

    <p>上周 DeepSeek 官方接口凌晨抖了 20 分钟,我一个跑批任务全红了。那天之后我决定不再把命系在单个供应商上。</p> <p>如果你也用 OpenAI SDK 调 DeepSeek / Qwen,最省事的容灾方案不是重写代码,而是前面挡一层 OpenAI 兼容网关:换 base_url 就行,业务代码一行不动。</p> <p>我是这么搭的(约 200 行 Python + FastAPI):</p> <ol> <li>统一 /v1/chat/completions 入口,把请求转给上游</li> <li>配两个上游:硅基流动(主)+ Deep…