I was building a coding agent last month that needed to juggle multiple models—a cheap, fast one for routine classification and a heavy-duty reasoning model for complex logic. Managing separate API keys, billing dashboards, and SDK integrations for each provider was becoming a nightmare. I kept thinking, "Why can't I just hit one endpoint and swap models like plugins?"
That's exactly the problem SiliconFlow solves. It's an inference platform that gives you a single API to access over 200 models—DeepSeek, GLM, Qwen, Stable Diffusion, you name it. What caught my attention was the OpenAI-compatible interface, which meant I wouldn't have to rewrite my existing codebase. I could just swap the base_url and go.
Here's how I got started, including the bumps I hit along the way.
Step 1: Account Setup
Creating an account was straightforward. I went to siliconflow.com and signed up using my GitHub account—OAuth is supported alongside Google, email, and SMS. The platform immediately dropped me into a dashboard showing my API usage, billing, and available credits.
One thing I appreciated: new accounts come with free tier credits. This let me test models without pulling out my credit card, which is always a relief when you're just kicking the tires on a new service.
Step 2: Exploring the Model Library
Before writing any code, I spent time on the Models page. This is where SiliconFlow shines. The catalog is massive—over 200 models across categories:
- LLMs: DeepSeek-R1, GLM-5.2, Kimi K2.7 Code, LongCat-2.0, Qwen variants
- Vision: Models for image understanding
- Image Generation: Stable Diffusion, FLUX, and others
- Video & Audio: Growing selection
Each model card shows you the details that actually matter: pricing per million tokens (input and output), cached input pricing, context window size, max output tokens, and rate limits. For example, when I looked at DeepSeek-R1, I could see it supports a massive context window and the pricing was significantly cheaper than what I was paying elsewhere.
Pro tip: Click "Online Experience" on any model's detail page to open a quick chat interface. I tested three different models this way before writing a single line of code, which saved me from burning API credits on models that didn't fit my use case.
Step 3: Testing in the Playground
The Playground is SiliconFlow's interactive testing environment. You access it from the left sidebar, where you can switch between language models, text-to-image, and image-to-image models.
I started by testing DeepSeek-R1 with a coding problem I already knew the answer to—a quick sanity check. You enter your prompt, adjust parameters like temperature and max tokens, then hit "Run." The response streams back in real time.
One surprise: the playground doesn't save your conversation history between sessions. If you find a prompt that works well, copy it immediately. I lost a carefully crafted system prompt because I assumed it would persist. It didn't.
Step 4: Generating an API Key
When I was ready to integrate into my project, I navigated to the API Keys page and clicked "Create API Key." The key generates instantly—something like sk-xxxxxxxxxxxxxxxxxxxxxxxx.
Important: Copy it immediately. The key is only shown once. I missed this the first time and had to delete and regenerate, which felt silly. Store it somewhere secure; I use a .env file that's gitignored:
SILICONFLOW_API_KEY=sk-your-key-here
Step 5: Making Your First API Call
Here's where things get fun. SiliconFlow supports two calling methods: direct REST API calls and the OpenAI-compatible interface. I went with the OpenAI route because my project already used the OpenAI SDK.
Setting Up the Environment
First, I created a virtual environment and installed the OpenAI library:
python -m venv siliconflow-env
source siliconflow-env/bin/activate # On Windows: siliconflow-env\Scripts\activate
pip install --upgrade openai
Verify the installation:
pip list | grep openai
You should see openai listed with a recent version number.
Writing the Code
The magic is in the base_url parameter. By pointing it to SiliconFlow's endpoint, all your existing OpenAI SDK code works unchanged:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("SILICONFLOW_API_KEY"),
base_url="https://api.siliconflow.com/v1"
)
# Simple non-streaming call
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=[
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "Write a Python function to find the longest palindromic substring."}
],
temperature=0.7,
max_tokens=2048
)
print(response.choices[0].message.content)
Streaming Responses
For longer outputs, streaming is essential. Here's how I handle it:
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=[
{"role": "user", "content": "Explain how transformer attention works, step by step."}
],
stream=True
)
for chunk in response:
if chunk.choices[0].delta.content is not None:
print(chunk.choices[0].delta.content, end="", flush=True)
The first time I ran this, I got an error because I forgot to check if delta.content was None—some chunks only contain role metadata. Adding that is not None check fixed it immediately.
Switching Models
This is where the single-API approach pays off. Want to try a different model? Just change the model string:
# Switch from DeepSeek to GLM-5.2
response = client.chat.completions.create(
model="THUDM/GLM-5.2", # Just swap this line
messages=[{"role": "user", "content": "Hello!"}],
stream=True
)
No new SDK, no new authentication, no different request format. I now keep a dictionary of model IDs in my config:
MODELS = {
"fast": "Qwen/Qwen2.5-7B-Instruct", # Cheap, quick tasks
"reasoning": "deepseek-ai/DeepSeek-R1", # Complex logic
"coding": "moonshotai/Kimi-K2.7-Code", # Code generation
"long": "LongCat/LongCat-2.0", # Massive context
}
Step 6: Image Generation
SiliconFlow isn't just text. I also tested their image models, which use a different endpoint pattern:
response = client.images.generate(
model="stabilityai/stable-diffusion-3-5-large",
prompt="A developer's desk with multiple monitors showing code, warm lighting, photorealistic",
size="1024x1024"
)
print(response.data[0].url) # Returns a URL to the generated image
The image generation was surprisingly fast—under 10 seconds for a 1024x1024 output. The quality was on par with what I'd get running Stable Diffusion locally, but without the GPU requirements.
Gotchas and Limitations
After using SiliconFlow for a few weeks, here's what I wish I'd known earlier:
Not all OpenAI parameters are supported. While the platform supports "most" OpenAI-related parameters, I found that some niche ones like
logprobsandtop_logprobsaren't available on every model. Check the model's documentation before relying on specific parameters.Model IDs must be exact. The model string needs to include the provider prefix—
deepseek-ai/DeepSeek-R1, not justDeepSeek-R1. I wasted 20 minutes debugging a "model not found" error because I omitted the prefix.Rate limits vary by model and tier. The Models page shows rate limits per model. The free tier has lower limits. I hit a rate limit during batch testing and had to add exponential backoff to my code.
Cached input pricing is a big deal. SiliconFlow offers significantly cheaper pricing for cached input tokens. For example, LongCat-2.0 charges $0.75/M for regular input but only $0.015/M for cached input—a 98% discount. If you're sending repeated system prompts (which most of us are), this adds up fast.
The playground doesn't generate code. Unlike some platforms, the playground won't spit out equivalent API code for your test prompts. You'll need to write the integration code yourself or use the documentation's code snippets.
Final Thoughts
SiliconFlow has become my go-to for model experimentation. The OpenAI-compatible API means zero integration friction, and having 200+ models behind one endpoint eliminates the multi-provider juggling act. The cached input pricing is genuinely competitive—my bill for a recent project came in at roughly 1/5th of what I'd have paid using the original providers directly.
It's not perfect: the documentation could be more detailed, some advanced parameters are missing, and the playground feels basic compared to competitors. But for a developer who just wants to call models quickly, cheaply, and with minimal setup friction, it delivers exactly what it promises.
Start with the free credits, test two or three models in the playground, and then integrate with the OpenAI SDK. You can have a working pipeline in under 30 minutes.