working-with-messages changedbuild-with-claude/working-with-messages
Nearest release: v2.1.307, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+6added
Lines−6removed
From line
20
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits18to this page, all time
The whole hunk
from line 20, old and new numbered
/
from line 20
2020## Basic request and response
2121
2222<Note>
23 The `temperature`, `top_p`, and `top_k` sampling parameters are not supported on Claude 4.7 and later models and Claude Mythos Preview, or on any model starting with [API version `2026-10-21`](https://platform.claude.com/docs/en/api/migration-2026-10-21#sampling-parameters). Setting them to a non-default value returns a 400 error, and starting with `2026-10-21` any value does. Omit them from request payloads and use prompting to guide the model's behavior instead. See the [migration guide](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#opus-46-breaking-changes).
23 The `temperature`, `top_p`, and `top_k` sampling parameters are not supported on Claude 4.7 and later models and Claude Mythos Preview, or on any model starting with [API version `2026-10-21`](https://platform.claude.com/docs/en/api/migration-2026-10-21#sampling-parameters). Setting them to a non-default value returns a 400 error, and starting with `2026-10-21` any value does. Omit them from request payloads and use prompting to guide the model's behavior instead. See the [breaking changes in the migration guide](https://platform.claude.com/docs/en/models/opus-5-5/migration-guide#opus-46-breaking-changes).
2424</Note>
2525
2626<CodeGroup>
from line 123
123123 client = Anthropic::Client.new
124124
125125 message = client.messages.create(
126 model: "claude-opus-5-5",
126 model: Anthropic::Model::CLAUDE_OPUS_5_5,
127127 max_tokens: 1024,
128128 messages: [
129129 { role: "user", content: "Hello, Claude" }
from line 288
288288 client = Anthropic::Client.new
289289
290290 message = client.messages.create(
291 model: "claude-opus-5-5",
291 model: Anthropic::Model::CLAUDE_OPUS_5_5,
292292 max_tokens: 1024,
293293 messages: [
294294 { role: "user", content: "Hello, Claude" },
from line 331
331331
332332## Prefilling Claude's response
333333
334You can pre-fill part of Claude's response in the last position of the input messages list. Use this technique to shape Claude's response. The following example uses `"max_tokens": 1` to get a single multiple choice answer from Claude.
334You can prefill part of Claude's response in the last position of the input messages list. Use this technique to shape Claude's response. The following example uses `"max_tokens": 1` to get a single multiple choice answer from Claude.
335335
336336<Warning>
337337 Prefilling is not supported on Claude 4.6 and later models and [Claude Mythos Preview](https://anthropic.com/glasswing). Requests using prefill with these models return a 400 error. Use [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs) on models that support it, or system prompt instructions, instead. See the [migration guide](https://platform.claude.com/docs/en/about-claude/models/migration-guide) for migration patterns.
from line 464
464464 client = Anthropic::Client.new
465465
466466 message = client.messages.create(
467 model: "claude-sonnet-4-5",
467 model: Anthropic::Model::CLAUDE_SONNET_4_5,
468468 max_tokens: 1,
469469 messages: [
470470 {
from line 501
501501
502502## Vision
503503
504Claude can read both text and images in requests. You can supply images using the `base64`, `url`, or `file` source types. The `file` source type references an image uploaded through the [Files API](https://platform.claude.com/docs/en/build-with-claude/files). Supported media types are `image/jpeg`, `image/png`, `image/gif`, and `image/webp`. See the [vision guide](https://platform.claude.com/docs/en/build-with-claude/vision) for more details.
504Claude can read both text and images in requests. You can supply images using the `base64`, `url`, or `file` source types. The `file` source type references an image uploaded through the [Files API](https://platform.claude.com/docs/en/build-with-claude/files). Supported media types are `image/jpeg`, `image/png`, `image/gif`, and `image/webp`. See the [Vision](https://platform.claude.com/docs/en/build-with-claude/vision) guide for more details.
505505
506506<CodeGroup>
507507 ```bash cURL
No line in this hunk matches that.