OpenAI-Compatible API
ZBStream exposes an OpenAI-compatible Chat Completions API. Any OpenAI SDK or HTTP client that supports a custom base URL works out of the box — cURL, Python, Node.js, and Go included.
Endpoint & Authentication
All OpenAI-compatible requests go to a single base URL and authenticate with a Bearer API key. The model name must exactly match an id returned by GET /v1/models.
Authorization: Bearer $ZBSTREAM_API_KEY
Content-Type: application/json| Parameter | Value | Description |
|---|---|---|
| Base URL | https://api.zbstream.com/v1 | Base address for all OpenAI-compatible requests |
| Auth | Authorization: Bearer <key> | A ZBStream API key created in the console |
| Models | GET /v1/models | List models available to the current API key |
Send a Chat Completion
The same non-streaming chat request in four languages. The response follows the OpenAI Chat Completions structure — read choices[0].message.content directly.
curl https://api.zbstream.com/v1/chat/completions \
-H "Authorization: Bearer $ZBSTREAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-pro",
"messages": [
{ "role": "user", "content": "你好,请介绍一下 ZBStream API。" }
],
"stream": false
}'
Streaming Responses
Add "stream": true to the request body to receive an SSE stream. Read data events in order and close the connection when the [DONE] marker arrives.
curl https://api.zbstream.com/v1/chat/completions \
-H "Authorization: Bearer $ZBSTREAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-pro",
"messages": [{ "role": "user", "content": "请逐步回答" }],
"stream": true
}'
List Available Models
Call GET /v1/models to list the models available to your API key. Read this list dynamically instead of hard-coding model ids.
curl https://api.zbstream.com/v1/models \
-H "Authorization: Bearer $ZBSTREAM_API_KEY"Compatibility Notes
- The official openai-python and openai-node SDKs work by simply setting base_url.
- Sampling parameters such as temperature and top_p are forwarded as-is; supported ranges depend on the selected model.
- Only the model field is rewritten during model mapping — all other fields are forwarded to the upstream channel unchanged.
- Fields not documented here may still be forwarded, but are not part of the compatibility guarantee; capabilities follow the current model and channel configuration.