Table of Contents

Class ClaudeMessage

public class ClaudeMessage : ClaudeResponse
Inheritance
object
ClaudeMessage
Inherited Members

Properties

Container

Required. Information about the container used in this request.

This will be non-null if a container tool (e.g. code execution) was used.

public AnthropicContainer Container { get; set; }

Property Value

AnthropicContainer

Content

Required. Content generated by the model.

This is an array of content blocks, each of which has a type that determines its shape.

Example:

[{"type": "text", "text": "Hi, I'm Claude."}]

If the request input messages ended with an assistant turn, then the response content will continue directly from that last turn. You can use this to constrain the model's output.

For example, if the input messages were:

[{"role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun"}, {"role": "assistant", "content": "The best answer is ("}]

Then the response content might be: [{"type": "text", "text": "B)"}]

public StringOrArray<ContentBlock> Content { get; set; }

Property Value

StringOrArray<ContentBlock>

Model

Required. The model that handled the request.

public string Model { get; set; }

Property Value

string

Role

Required. Conversational role of the generated message.

This will always be "assistant".

public ChatRole Role { get; set; }

Property Value

ChatRole

StopReason

Required. The reason that we stopped.

This may be one the following values:

"end_turn": the model reached a natural stopping point "max_tokens": we exceeded the requested max_tokens or the model's maximum "stop_sequence": one of your provided custom stop_sequences was generated "tool_use": the model invoked one or more tools "pause_turn": we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. "refusal": when streaming classifiers intervene to handle potential policy violations

In non-streaming mode this value is always non-null. In streaming mode, it is null in the message_start event and non-null otherwise.

public StopReason? StopReason { get; set; }

Property Value

StopReason?

StopSequence

Required. Which custom stop sequence was generated, if any.

This value will be a non-null string if one of your custom stop sequences was generated.

public string StopSequence { get; set; }

Property Value

string

Usage

Required. Billing and rate-limit usage.

Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems.

public ClaudeUsage Usage { get; set; }

Property Value

ClaudeUsage