Claude Platform Docs

Completions

Create a Text Completion
Deprecated
Completion completions().create(params, requestOptions = RequestOptions.none())
POST/v1/complete

[Legacy] Create a Text Completion.

Models
class Completion { type = "completion"; id; completion; /* 2 more */ }
JsonValue type = "completion"

Object type.

For Text Completions, this is always "completion".

String id

Unique object identifier.

The format and length of IDs may change over time.

String completion

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:
Optional<String> stopReason

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