GoodPut AI

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

ParameterDescription
modelRequired; a model ID from the catalog
messagesRequired; supports system / user / assistant / tool roles
stream / stream_optionsSee streaming
tools / tool_choiceSee tool calls
response_formatSee structured output
max_tokens / max_completion_tokensOutput limit, including reasoning tokens
temperature / top_p / stopSampling and stop controls
fallbacksPlatform 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

EndpointDescription
GET /v1/modelsModels available to the current key
POST /v1/completionsLegacy text completion, retained for compatibility; use Chat Completions for new integrations
POST /v1/videosSubmit an asynchronous video generation task
GET /v1/videos/{video_id}Query video task status
GET /v1/videos/{video_id}/contentDownload 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.

On this page