> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 聊天补全

> 使用 Go 封装调用 /chat/completions。

使用封装方法：

* `client.GenerateText(ctx, req)`

```go theme={null}
import (
  "context"
  "fmt"
  phaseo "github.com/phaseoteam/Phaseo/packages/sdk/sdk-go/v3"
)

client := phaseo.New(apiKey, "https://api.phaseo.app/v1")
resp, err := client.GenerateText(context.Background(), phaseo.ChatCompletionsRequest{
  Model: "openai/gpt-5-nano",
  Messages: []map[string]interface{}{
    {
      "role": "user",
      "content": "Write a one-line haiku.",
    },
  },
})
if err != nil {
  panic(err)
}

fmt.Println(resp)
```

封装库尚未提供专用的流式传输辅助方法。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.