Claude Platform Docs

补全

创建文本补全
Deprecated
client.Completions.New(ctx, params) (*Completion, error)
POST/v1/complete

[旧版] 创建文本补全。

Models
type Completion struct { Type: "completion"; ID; Completion; /* 2 more */ }
Type Completion

Object type.

For Text Completions, this is always "completion".

defaultcompletion
ID string

Unique object identifier.

The format and length of IDs may change over time.

Completion string

The resulting completion up to and excluding the stop sequences.

Model Model

The model that will complete your prompt.

See models for additional details and options.

One of the following:
StopReason string

The reason that we stopped.

This may be one the following values:

  • "stop_sequence": we reached a stop sequence — either provided by you via the stop_sequences parameter, or a stop sequence built into the model
  • "max_tokens": we exceeded max_tokens_to_sample or the model's maximum