Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Chat

ChatCompletions

Given a list of messages comprising a conversation, the model will return a response.

Create chat completion
client.Chat.Completions.New(ctx, body) (*ChatCompletion, error)
POST/chat/completions
Delete chat completion
client.Chat.Completions.Delete(ctx, completionID) (*ChatCompletionDeleted, error)
DELETE/chat/completions/{completion_id}
List Chat Completions
client.Chat.Completions.List(ctx, query) (*CursorPage[ChatCompletion], error)
GET/chat/completions
Get chat completion
client.Chat.Completions.Get(ctx, completionID) (*ChatCompletion, error)
GET/chat/completions/{completion_id}
Update chat completion
client.Chat.Completions.Update(ctx, completionID, body) (*ChatCompletion, error)
POST/chat/completions/{completion_id}
ModelsExpand Collapse
type ChatCompletionAllowedTools struct{…}

Constrains the tools available to the model to a pre-defined set.

type ChatCompletion struct{…}

Represents a chat completion response returned by model, based on the provided input.

type ChatCompletionAllowedToolChoice struct{…}

Constrains the tools available to the model to a pre-defined set.

type ChatCompletionAssistantMessageParamResp struct{…}

Messages sent by the model in response to user messages.

type ChatCompletionAudio struct{…}

If the audio output modality is requested, this object contains data about the audio response from the model. Learn more.

type ChatCompletionAudioParamResp struct{…}

Parameters for audio output. Required when audio output is requested with modalities: ["audio"]. Learn more.

type ChatCompletionChunk struct{…}

Represents a streamed chunk of a chat completion response returned by the model, based on the provided input. Learn more.

type ChatCompletionContentPartUnion interface{…}

Learn about text inputs.

type ChatCompletionContentPartImage struct{…}

Learn about image inputs.

type ChatCompletionContentPartInputAudio struct{…}

Learn about audio inputs.

type ChatCompletionContentPartRefusal struct{…}
type ChatCompletionContentPartText struct{…}

Learn about text inputs.

type ChatCompletionCustomTool struct{…}

A custom tool that processes input using a specified format.

type ChatCompletionDeleted struct{…}
type ChatCompletionDeveloperMessageParamResp struct{…}

Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, developer messages replace the previous system messages.

type ChatCompletionFunctionCallOption struct{…}

Specifying a particular function via {"name": "my_function"} forces the model to call that function.

type ChatCompletionFunctionMessageParamResp struct{…}
type ChatCompletionFunctionTool struct{…}

A function tool that can be used to generate a response.

type ChatCompletionMessage struct{…}

A chat completion message generated by the model.

type ChatCompletionMessageCustomToolCall struct{…}

A call to a custom tool created by the model.

type ChatCompletionMessageFunctionToolCall struct{…}

A call to a function tool created by the model.

type ChatCompletionMessageParamUnionResp interface{…}

Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, developer messages replace the previous system messages.

type ChatCompletionMessageToolCallUnion interface{…}

A call to a function tool created by the model.

type ChatCompletionModality string
type ChatCompletionNamedToolChoice struct{…}

Specifies a tool the model should use. Use to force the model to call a specific function.

type ChatCompletionNamedToolChoiceCustom struct{…}

Specifies a tool the model should use. Use to force the model to call a specific custom tool.

type ChatCompletionPredictionContent struct{…}

Static predicted output content, such as the content of a text file that is being regenerated.

type ChatCompletionRole string

The role of the author of a message

type ChatCompletionStoreMessage struct{…}

A chat completion message generated by the model.

type ChatCompletionStreamOptions struct{…}

Options for streaming response. Only set this when you set stream: true.

type ChatCompletionSystemMessageParamResp struct{…}

Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use developer messages for this purpose instead.

type ChatCompletionTokenLogprob struct{…}
type ChatCompletionToolUnion interface{…}

A function tool that can be used to generate a response.

type ChatCompletionToolChoiceOptionUnion interface{…}

Controls which (if any) tool is called by the model. none means the model will not call any tool and instead generates a message. auto means the model can pick between generating a message or calling one or more tools. required means the model must call one or more tools. Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

none is the default when no tools are present. auto is the default if tools are present.

type ChatCompletionToolMessageParamResp struct{…}
type ChatCompletionUserMessageParamResp struct{…}

Messages sent by an end user, containing prompts or additional context information.

ChatCompletionsMessages

Given a list of messages comprising a conversation, the model will return a response.

Get chat messages
client.Chat.Completions.Messages.List(ctx, completionID, query) (*CursorPage[ChatCompletionStoreMessage], error)
GET/chat/completions/{completion_id}/messages