Skip to main content
POST
Chat completions
POST /v1/chat/completions 是 PhanEdge 接入 GLM 的默认入口。

基础请求

GLM 特有能力

thinking

GLM OpenAI 兼容入口支持透传 thinking 对象:
GLM 的联网搜索不是普通 function tool。你需要传入完整的原生 web_search 子对象,详见 GLM 联网搜索

什么时候用这个入口

  • 你正在使用 OpenAI SDK、OpenAI 风格的网关、或现有 chat/completions 代码路径
  • 你需要统一接入多个 provider,同时保留 GLM 的少量原生扩展字段

什么时候不要用这个入口

  • 你的应用明确依赖 Anthropic Messages 协议、Message blocks 或 Anthropic SDK
  • 你只想接入 GLM 的 Anthropic 兼容能力,此时应使用 Anthropic 兼容

返回结果

普通文本调用返回标准 OpenAI 风格的:
  • choices[].message.content
  • usage
  • reasoning_content(当上游返回时)
如果请求里使用了 web_search,并且上游返回搜索证据,响应顶层还会出现:

Authorizations

Authorization
string
header
required

Authorization: Bearer

Body

application/json

The body is of type object.

Response

200 - application/json

OK

The response is of type object.