Text API
Send your first chat request, connect an SDK, or configure your favorite AI application.
/v1/chat/completionsText API Quickstart
Create an API key, choose an enabled text model, and send your first OpenAI-compatible request.
Create an API key
Open Console → API Keys. Create a key with access to your chosen model. Confirm your account has available credit.
Choose a text model
Copy an enabled text model ID from Model Square. Use the exact ID, including any version suffix.
Send a request
Replace the highlighted key and model ID. Run in Bash or zsh; keep your key server-side.
export SINOROUTER_API_KEY="YOUR_API_KEY"
curl https://api.sinorouter.ai/v1/chat/completions \
-H "Authorization: Bearer $SINOROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_TEXT_MODEL_ID",
"messages": [
{"role": "user", "content": "Say hello."}
]
}'choices[0].message.content.For errors, see Troubleshooting below. Live requests may incur usage charges.
SDK Examples
Set the key as in First request above. Replace the highlighted model ID.
Python
python -m pip install openaiimport os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["SINOROUTER_API_KEY"],
base_url="https://api.sinorouter.ai/v1",
)
response = client.chat.completions.create(
model="YOUR_TEXT_MODEL_ID",
messages=[{"role": "user", "content": "Say hello."}],
)
print(response.choices[0].message.content)JavaScript
npm install openaiimport OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.SINOROUTER_API_KEY,
baseURL: "https://api.sinorouter.ai/v1",
});
const response = await client.chat.completions.create({
model: "YOUR_TEXT_MODEL_ID",
messages: [{ role: "user", content: "Say hello." }],
});
console.log(response.choices[0].message.content);Run: python quickstart.py or node quickstart.mjs.
Client Setup
Choose the address for your client. Include /v1 exactly once.
https://api.sinorouter.ai/https://api.sinorouter.ai/v1https://api.sinorouter.ai/v1/chat/completionsPopular integrations
Enter your key and exact text model ID. Menu labels and path handling can vary by app version.
| Client | URL | Configuration |
|---|---|---|
| Cherry Studio | Root | Select New API under Model Services; set API Address, fetch models and run Test. |
| Open WebUI | SDK base | Add an OpenAI-compatible connection under Admin → Connections. |
| Chatbox | Root | Select OpenAI API compatible. Keep the request path /v1/chat/completions. |
| Dify | SDK base | Use the OpenAI-API-compatible provider by langgenius; add and validate a custom LLM. |
| n8n | HTTP POST | Use an HTTP Request node with Bearer auth and a JSON body, following First request above. |
| LangChain | SDK base | Use ChatOpenAI from langchain_openai with a custom base_url. |
/v1.Troubleshooting
A successful response
Illustrative excerpt; actual text and additional fields vary.
{
"choices": [{
"message": {"role": "assistant", "content": "Hello!"},
"finish_reason": "stop"
}]
}If the request fails
Read the error message as well as the HTTP status.
| 400 | Check the request body. Validate JSON, required fields and any model-specific parameters. |
| 401 | Check authentication. Confirm Bearer auth, key status and extra spaces. |
| 403 | Check access. Confirm the key’s group or permissions allow the chosen model. |
| 404 | Check the URL and model. Verify the full endpoint and the exact enabled model ID. |
| 429 | Read the limit message. Check rate, concurrency or account quota as indicated by the error. |
| 5xx | Check gateway or upstream errors. Use limited retries with backoff. Repeated requests may add usage. |
Still blocked?
Send client/version, endpoint, model ID, HTTP status, time with timezone, and a redacted error response.
support@sinorouter.ai · Never send your full API key.