The whole hunk
from line 1, old and new numbered
/
lines
from line 1
1---
2title: Completions
3url: https://platform.claude.com/docs/en/api/completions
4---
5
16# Completions
27
38## Create a Text Completion
from line 23
1823
1924 - `string`
2025
21 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 41 more`
26 - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 42 more`
2227
2328 - `"message-batches-2024-09-24"`
2429
from line 71
6671
6772 - `"user-profiles-2026-08-18"`
6873
74 - `"user-profiles-2026-09-04"`
75
6976 - `"advisor-tool-2026-03-01"`
7077
7178 - `"managed-agents-2026-04-01"`
from line 115
108115
109116 - `"mid-conversation-system-clear-at-2026-08-21"`
110117
118- `"anthropic-workspace-id": optional string`
119
111120### Body parameters
112121
113122- `max_tokens_to_sample: number`
from line 297
288297
289298- `Completion object`
290299
300 - `type: "completion"`
301
302 Object type.
303
304 For Text Completions, this is always `"completion"`.
305
306 default: completion
307
291308 - `id: string`
292309
293310 Unique object identifier.
from line 406
389406 * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model
390407 * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
391408
392 - `type: "completion"`
393
394 Object type.
395
396 For Text Completions, this is always `"completion"`.
397
398 default: completion
399
400409### Example
401410
402411```bash
from line 442
433442
434443- `Completion object`
435444
445 - `type: "completion"`
446
447 Object type.
448
449 For Text Completions, this is always `"completion"`.
450
451 default: completion
452
436453 - `id: string`
437454
438455 Unique object identifier.
from line 550
533550
534551 * `"stop_sequence"`: we reached a stop sequence — either provided by you via the `stop_sequences` parameter, or a stop sequence built into the model
535552 * `"max_tokens"`: we exceeded `max_tokens_to_sample` or the model's maximum
536
537 - `type: "completion"`
538
539 Object type.
540
541 For Text Completions, this is always `"completion"`.
542
543 default: completion
544553