惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
D
DataBreaches.Net
V
Visual Studio Blog
M
MIT News - Artificial intelligence
C
Check Point Blog
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
F
Full Disclosure
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
Recorded Future
Recorded Future
B
Blog RSS Feed
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
Forbes - Security
Forbes - Security
美团技术团队
Google DeepMind News
Google DeepMind News
H
Help Net Security
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
W
WeLiveSecurity
MyScale Blog
MyScale Blog
O
OpenAI News
P
Privacy & Cybersecurity Law Blog
Attack and Defense Labs
Attack and Defense Labs
N
Netflix TechBlog - Medium
T
Troy Hunt's Blog
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
V
V2EX
WordPress大学
WordPress大学
H
Heimdal Security Blog
U
Unit 42
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
SecWiki News
SecWiki News
D
Docker
Blog — PlanetScale
Blog — PlanetScale
S
Secure Thoughts

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How to use one OpenAI-compatible gateway for chat, responses, embeddings, rerank, image, and audio APIs
Chinallmapi · 2026-04-29 · via DEV Community

If you're building an AI-powered app today, you're probably juggling multiple model providers. OpenAI for GPT. DeepSeek for cost savings. A Chinese model for specific tasks. Maybe Anthropic for Claude.

Each provider has its own SDK, its own auth flow, its own quirks. That's not just annoying—it's fragile. Switching models means rewriting code. Adding a new provider means more maintenance burden.

There's a cleaner approach: one gateway that speaks OpenAI's protocol, but routes to multiple backends.

This isn't about replacing your provider. It's about abstracting the integration layer so you can swap, compare, and combine models without touching your application code.

Let's walk through what this looks like in practice, using ChinaLLM as a concrete example of a publicly documented gateway.


Why OpenAI-compatible matters more than another SDK

The OpenAI API format has become a de facto standard. Most AI tools—LangChain, AutoGen, custom agents—expect an OpenAI-style interface:

If you switch to another provider, you either:

  • Rewrite your integration code
  • Use a provider-specific SDK (and lock yourself in)
  • Find a gateway that translates everything into the format you already know

The third option is increasingly viable. A gateway that exposes OpenAI-compatible endpoints but routes to multiple backends gives you:

  • Portability: change providers without code changes
  • Comparison: test different models side-by-side with the same API call
  • Cost optimization: route to cheaper models when quality differences don't matter
  • Simpler stack: one auth flow, one SDK, one set of error handling patterns

This isn't theoretical. ChinaLLM, for instance, exposes exactly this kind of gateway—publicly documented, with known endpoints and pricing.


What ChinaLLM publicly exposes today

ChinaLLM is an OpenAI-compatible API gateway that routes to both OpenAI models and China-native providers (DeepSeek, Alibaba coding plans, GLM, ZAI).

Public documentation shows the following endpoints:

Core chat:

  • /v1/chat/completions — standard OpenAI chat format
  • /v1/responses — OpenAI Responses API format
  • /v1/responses/compact — compacted responses for lower token usage
  • /v1/messages — Anthropic-style messages (Claude protocol)

Discovery and embeddings:

  • /v1beta/models — list available models
  • /v1/embeddings — text embeddings
  • /v1/rerank — reranking for search/RAG pipelines

Image:

  • /v1/images/generations — generate images from text
  • /v1/images/edits — edit existing images
  • /v1/images/variations — create variations of an image

Audio:

  • /v1/audio/speech — text-to-speech
  • /v1/audio/transcriptions — speech-to-text
  • /v1/audio/translations — translate audio to English text

All endpoints use OpenAI-compatible request/response formats. The same SDK you use for OpenAI works here—just change the base URL.


Getting a token and setting a base URL

The setup is minimal:

  1. Get an API key from ChinaLLM (signup process is standard)
  2. Set your base URL to https://chinallmapi.com/v1
  3. Use your existing OpenAI SDK or HTTP client

No new dependencies. No new auth patterns.

For complete code examples, see the GitHub repo.

Example with OpenAI Python SDK:

import openai

client = openai.OpenAI(
    api_key="your-chinallm-key",
    base_url="https://chinallmapi.com/v1"
)

# Now use it exactly like you would with OpenAI
response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "What's the capital of France?"}]
)

print(response.choices[0].message.content)

Enter fullscreen mode Exit fullscreen mode

Same SDK. Same method signatures. Different backend.


First request with /v1/chat/completions

Let's make a real request. We'll use a cost-efficient model from the public pricing list: deepseek-v4-flash.

import openai

client = openai.OpenAI(
    api_key="your-chinallm-key",
    base_url="https://chinallmapi.com/v1"
)

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[
        {"role": "system", "content": "You are a helpful coding assistant."},
        {"role": "user", "content": "Write a Python function to merge two sorted lists."}
    ],
    temperature=0.7
)

print(response.choices[0].message.content)

Enter fullscreen mode Exit fullscreen mode

This returns a response in standard OpenAI format.

The key insight: you didn't change any code to switch from OpenAI to DeepSeek. You just changed the model name.


Expanding beyond chat (responses / embeddings / rerank)

Chat is the obvious use case. But a unified gateway becomes more valuable when you need multiple capabilities in the same app.

Responses API

The Responses API (/v1/responses) is useful when you want structured outputs with built-in reasoning traces:

response = client.responses.create(
    model="gpt-5.4",
    input="Analyze this customer feedback and extract sentiment, topic, and action items.",
    instructions="Return a JSON object with sentiment, topic, and action_items fields."
)

print(response.output)

Enter fullscreen mode Exit fullscreen mode

Embeddings

For RAG or semantic search:

embedding = client.embeddings.create(
    model="text-embedding-3-small",
    input="What are the best practices for API design?"
)

vector = embedding.data[0].embedding
print(f"Embedding dimension: {len(vector)}")

Enter fullscreen mode Exit fullscreen mode

Rerank

When you have multiple candidate documents and need to rank them by relevance to a query:

import requests

response = requests.post(
    "https://chinallmapi.com/v1/rerank",
    headers={"Authorization": f"Bearer {api_key}"},
    json={
        "model": "rerank-model",
        "query": "What is the refund policy?",
        "documents": [
            "Our refund policy allows returns within 30 days...",
            "Shipping takes 5-7 business days...",
            "We accept PayPal and credit cards..."
        ]
    }
)

print(response.json()["results"])

Enter fullscreen mode Exit fullscreen mode

Each capability uses the same auth pattern, same base URL, familiar request formats. No separate SDKs for embeddings vs. chat vs. rerank.


Public pricing and model discovery

ChinaLLM's pricing page shows transparent model costs with group-specific multipliers:

Group multipliers:

  • CodingPlan (Alibaba coding plans): 1.1x
  • DeepSeek: 1.05x
  • GLM: 1.05x
  • OpenAI: 1.3x

This means:

  • DeepSeek models cost roughly 5% more than base DeepSeek pricing
  • OpenAI models cost roughly 30% more than base OpenAI pricing
  • The gateway adds a margin, but you get unified access and simpler integration

Visible models (partial list from public docs):

  • gpt-5.4, gpt-5.5 (OpenAI)
  • gpt-image-2 (OpenAI image model)
  • deepseek-v4-flash, deepseek-v4-pro (DeepSeek)
  • glm-4.7 (GLM/Zhipu)

To discover all available models:

models = client.models.list()
for model in models.data:
    print(model.id)

Enter fullscreen mode Exit fullscreen mode

This returns the current model catalog—useful when new models are added without announcement.


When this approach is useful

A unified gateway isn't for everyone. But it's particularly valuable when:

  1. You're comparing models. You want to test GPT vs. DeepSeek vs. GLM on the same task without rewriting integration code.

  2. You're optimizing costs. You want to route simple queries to cheaper models and complex ones to premium models—all through one API.

  3. You're building multi-modal apps. You need chat + embeddings + images + audio in one stack, and don't want separate auth flows for each.

  4. You're building tooling. You want your framework to support multiple providers out of the box, without hardcoding provider-specific logic.

  5. You're hedging provider risk. You want the option to switch providers quickly if pricing changes, service quality drops, or better options emerge.

The gateway approach abstracts away provider differences. You still need to know which model to use for which task—but you don't need separate code for each provider.


Final takeaway

One OpenAI-compatible gateway. Multiple backends. Same SDK. Same auth. Same request formats.

This isn't about replacing your provider. It's about making your integration layer more portable, more testable, and more resilient to provider changes.

ChinaLLM is one concrete implementation of this pattern—publicly documented, with transparent pricing and a clear model catalog. If you're evaluating this approach, it's a useful reference point.

The bigger idea: stop writing provider-specific integration code. Write to a standard interface, and let the gateway handle the routing.