curl Examples
树新在线 is compatible with the OpenAI API format. In the examples below, replace sk-xxxx with your token to run them.
Chat (non-streaming)
bash
curl https://api.treenew.online/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{
"model": "gpt-5.1",
"messages": [
{"role": "user", "content": "Introduce yourself in one sentence"}
]
}'Chat (streaming)
Add "stream": true, and the response is returned segment by segment as SSE:
bash
curl https://api.treenew.online/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxx" \
-d '{
"model": "gpt-5.1",
"messages": [
{"role": "user", "content": "Write a short poem about trees"}
],
"stream": true
}'List available models
bash
curl https://api.treenew.online/v1/models \
-H "Authorization: Bearer sk-xxxx"Returns the list of models available to the current token.
Notes
- Model names are as shown in the console's “Model Square”
- No need to worry about large request bodies (e.g. with images) — the gateway supports request bodies up to 64 MB
- Other parameters (
temperature,max_tokens, etc.) match the official OpenAI docs