OpenAI-compatible API
Chat Completions and Responses endpoints, parameters, and response structures.
Chat Completions
Use POST /v1/chat/completions, with the same semantics as OpenAI. Authenticate with Authorization: Bearer <API Key>.
from openai import OpenAI
client = OpenAI(
base_url="https://api.goodputai.cn/v1",
api_key="YOUR_GOODPUT_API_KEY",
)
resp = client.chat.completions.create(
model="deepseek/deepseek-v4-pro",
messages=[{"role": "user", "content": "Hello"}],
)Supported parameters
| Parameter | Description |
|---|---|
model | Required; a model ID from the catalog |
messages | Required; supports system / user / assistant / tool roles |
stream / stream_options | See streaming |
tools / tool_choice | See tool calls |
response_format | See structured output |
max_tokens / max_completion_tokens | Output limit, including reasoning tokens |
temperature / top_p / stop | Sampling and stop controls |
fallbacks | Platform extension for fallback models; see platform concepts |
Parameters unsupported by an upstream model are safely ignored by the gateway without failing the request.
Response structure
Responses follow the OpenAI structure. Reasoning models also return reasoning content and a token breakdown:
{
"choices": [{
"message": {
"role": "assistant",
"content": "ok",
"reasoning_content": "The user asked for only ok…"
}
}],
"usage": {
"prompt_tokens": 17,
"completion_tokens": 25,
"total_tokens": 42,
"completion_tokens_details": {"reasoning_tokens": 22, "text_tokens": 3},
"prompt_tokens_details": {"cached_tokens": 0}
}
}message.reasoning_content: model reasoning; see reasoning models.usage.completion_tokens_details.reasoning_tokens: reasoning tokens, billed as output.usage.prompt_tokens_details.cached_tokens: cache-hit tokens, billed at the cache-read price; see prompt caching.
Responses API
POST /v1/responses supports the OpenAI Responses protocol for all platform models:
resp = client.responses.create(
model="z-ai/glm-5.2",
input="Introduce yourself in one sentence",
)
print(resp.output_text)Reasoning is returned in output items with type: "reasoning", or reasoning_summary_text.delta events when streaming. max_output_tokens includes reasoning tokens. For reasoning models, use at least 512; a very small limit can produce status: "incomplete" with an empty answer.
Other endpoints
| Endpoint | Description |
|---|---|
GET /v1/models | Models available to the current key |
POST /v1/completions | Legacy text completion, retained for compatibility; use Chat Completions for new integrations |
POST /v1/videos | Submit an asynchronous video generation task |
GET /v1/videos/{video_id} | Query video task status |
GET /v1/videos/{video_id}/content | Download the generated video |
Notes
- A missing or unavailable model returns 404 (
code: model_not_found); see errors and rate limits. - Default per-request timeouts start at 300 seconds. Use streaming for long tasks.