July 2026 | 6 min read | By AI-Token-Hub Team
Chinese LLMs like DeepSeek, Qwen, and GLM offer incredible performance at a fraction of OpenAI's cost. This guide shows you how to integrate them with LangChain in minutes using AI-Token-Hub's unified API.
LangChain is the most popular framework for building LLM-powered applications. Combined with Chinese LLMs, you get:
pip install langchain-openai langchain-core
1 Get your AI-Token-Hub API key
Sign up at /get-started and get 50,000 free tokens.
2 Set up the ChatModel
from langchain_openai import ChatOpenAI
# Initialize with AI-Token-Hub
llm = ChatOpenAI(
model="deepseek-v4", # or qwen3.6-flash, glm-4-flash, etc.
api_key="sk-your-ai-token-hub-key",
base_url="https://eaf9553505eeb8f5-115-190-107-107.serveousercontent.com/v1",
temperature=0.7
)
# Use it like any LangChain model
response = llm.invoke("Explain quantum computing in simple terms")
print(response.content)
3 Build a RAG pipeline with Chinese LLMs
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.output_parsers import StrOutputParser
# Setup
llm = ChatOpenAI(
model="deepseek-v4",
api_key="sk-your-key",
base_url="https://eaf9553505eeb8f5-115-190-107-107.serveousercontent.com/v1"
)
# Create a chain
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful assistant that answers questions concisely."),
("user", "{question}")
])
chain = prompt | llm | StrOutputParser()
# Run it
result = chain.invoke({"question": "What are the advantages of DeepSeek V4?"})
print(result)
4 Multi-model routing (advanced)
Use different models for different tasks to optimize cost and quality:
# Expensive model for complex tasks
complex_llm = ChatOpenAI(
model="deepseek-r1",
api_key="sk-your-key",
base_url="https://eaf9553505eeb8f5-115-190-107-107.serveousercontent.com/v1"
)
# Cheap model for simple tasks
simple_llm = ChatOpenAI(
model="deepseek-v4-flash", # $0.001/M tokens!
api_key="sk-your-key",
base_url="https://eaf9553505eeb8f5-115-190-107-107.serveousercontent.com/v1"
)
# Route based on task complexity
def route_query(question):
if len(question.split()) > 20 or "analyze" in question.lower():
return complex_llm
return simple_llm
| Use Case | Recommended Model | Cost/M tokens |
|---|---|---|
| Chatbot / Q&A | deepseek-v4-flash | $0.001 |
| Content Generation | qwen3.6-flash | $0.01-0.03 |
| Code Generation | deepseek-v4 | $0.27/1.10 |
| Complex Reasoning | deepseek-r1 | $0.50/2.00 |
| Prototyping / Testing | glm-4-flash | FREE |
glm-4-flash for development and testing - it's completely free! Then switch to deepseek-v4 or qwen3.6-flash for production.
For a typical RAG application processing 1M tokens/day:
| Provider | Monthly Cost |
|---|---|
| GPT-4o (OpenAI) | ~$375 |
| Claude 3.5 Sonnet | ~$540 |
| DeepSeek V4 (via AI-Token-Hub) | ~$41 |
| Qwen 3.6 Flash (via AI-Token-Hub) | ~$6 |
Get your free API key and start building with Chinese LLMs + LangChain in under 5 minutes.
Get Free API Key → View Full API Docs →