DEV Community

XLB223
XLB223

Posted on

OpenAI SDK DeepSeek / Qwen / GLM without rewriting your app

I wanted to try Chinese LLMs (DeepSeek, Qwen, GLM) without maintaining multiple SDKs.

Approach

Use an OpenAI-compatible gateway. Keep your existing client; change base URL + API key.

Quick start

  1. Sign up at https://apihub4u.com (trial credits on signup)
  2. Create an API key
  3. Point your SDK to: https://apihub4u.com/v1
  4. Set model to e.g. deepseek-chat or qwen-turbo

Example (Python)

from openai import OpenAI

client = OpenAI(
api_key="YOUR_KEY",
base_url="https://apihub4u.com/v1",
)

resp = client.chat.completions.create(
model="deepseek-chat",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)

Notes

  • Streaming works (SSE)
  • Prices are listed on the dashboard / docs
  • Overseas top-ups via PayPal

Docs: https://apihub4u.com/docs.html


Enter fullscreen mode Exit fullscreen mode

Top comments (0)