DEVELOPER REFERENCE / TEXT & CODE

Text API

Send your first chat request, connect an SDK, or configure your favorite AI application.

Updated November 7, 2026Chat Completions
POST/v1/chat/completions
Replace placeholders and check model access before running requests. Live requests may incur usage charges.

Text API Quickstart

Create an API key, choose an enabled text model, and send your first OpenAI-compatible request.

01

Create an API key

Open Console → API Keys. Create a key with access to your chosen model. Confirm your account has available credit.

02

Choose a text model

Copy an enabled text model ID from Model Square. Use the exact ID, including any version suffix.

03

Send a request

Replace the highlighted key and model ID. Run in Bash or zsh; keep your key server-side.

quickstart.sh · Bash / zsh
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."}
    ]
  }'
Read the reply: 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 openai
quickstart.py · Python
import 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 openai
quickstart.mjs · Node.js
import 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.

ROOT
https://api.sinorouter.ai/
SDK BASE
https://api.sinorouter.ai/v1
HTTP POST
https://api.sinorouter.ai/v1/chat/completions

Popular integrations

Enter your key and exact text model ID. Menu labels and path handling can vary by app version.

ClientURLConfiguration
Cherry StudioRootSelect New API under Model Services; set API Address, fetch models and run Test.
Open WebUISDK baseAdd an OpenAI-compatible connection under Admin → Connections.
ChatboxRootSelect OpenAI API compatible. Keep the request path /v1/chat/completions.
DifySDK baseUse the OpenAI-API-compatible provider by langgenius; add and validate a custom LLM.
n8nHTTP POSTUse an HTTP Request node with Bearer auth and a JSON body, following First request above.
LangChainSDK baseUse ChatOpenAI from langchain_openai with a custom base_url.
Getting a 404? Check for a missing or duplicated /v1.

Troubleshooting

A successful response

Illustrative excerpt; actual text and additional fields vary.

ILLUSTRATIVE RESPONSE · EXCERPT
{
  "choices": [{
    "message": {"role": "assistant", "content": "Hello!"},
    "finish_reason": "stop"
  }]
}

If the request fails

Read the error message as well as the HTTP status.

400Check the request body. Validate JSON, required fields and any model-specific parameters.
401Check authentication. Confirm Bearer auth, key status and extra spaces.
403Check access. Confirm the key’s group or permissions allow the chosen model.
404Check the URL and model. Verify the full endpoint and the exact enabled model ID.
429Read the limit message. Check rate, concurrency or account quota as indicated by the error.
5xxCheck 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.