Back to models
Qwen3-4B
Developed by Alibaba Qwen, Qwen3-4B is a compact 4B dense open-weight language model featuring switchable thinking and non-thinking modes for efficient reasoning, coding, and everyday dialogue.
What you can do
- Edge and single-GPU smart assistant
- Mode-switchable math and code reasoning
- Private document summarization and extraction
Input & output
- Input
- User prompts, tool schemas, and optional `/think` or `/no_think` mode control directives
- Output
- Optional chain-of-thought reasoning blocks followed by concise answers, code, or JSON tool calls
Try a prompt like this
/think 一批货物用甲车单独运需 12 次,乙车单独运需 18 次。现两车合运 4 次后剩余货物由乙车独运,还需几次运完?
Things to know
Apache 2.0 license; requires only ~8–9 GB VRAM in BF16 (or ~3 GB in INT4), fitting edge GPUs easily; niche factual recall should be paired with RAG.
All listed models publish open weights for self-hosted deployment; check each repository's license before commercial use.
Call it through the API
The platform exposes an OpenAI-compatible API. Use an official SDK or any HTTP client, then set the gateway URL, API key, and model ID.
- Endpoint
POST/v1/chat/completions- Model repo ID
Qwen/Qwen3-4B
import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ["API_BASE_URL"],
api_key=os.environ["API_KEY"],
)
response = client.chat.completions.create(
model="Qwen/Qwen3-4B",
messages=[{"role": "user", "content": "/think 一批货物用甲车单独运需 12 次,乙车单独运需 18 次。现两车合运 4 次后剩余货物由乙车独运,还需几次运完?"}],
)
print(response.choices[0].message.content)Before running a sample, set the API_BASE_URL (gateway URL) and API_KEY environment variables.
Read the full API guide