Anthropic Text Completions — POST /v1/complete (LEGACY)
Status: DOCUMENTED + LEGACY + DEPRECATED + FAILED_VERIFICATION — the reference page still documents the endpoint as "[Legacy]", but on 2026-09-18 every live request (retired claude-2.1 and current claude-haiku-4-5-20251001) returned 400 invalid_request_error: "The /v1/complete endpoint has been deprecated. Please use the /v1/messages endpoint instead. See https://platform.claude.com/docs/en/api/messages for details." Treat it as effectively retired.
Sources: https://platform.claude.com/docs/en/api/completions · https://platform.claude.com/docs/en/api/completions/create · https://platform.claude.com/docs/en/build-with-claude/working-with-messages (migration) · https://platform.claude.com/docs/en/api/versioning
Machine-readable: generated/fragments/parameters/anthropic-complete-legacy.json, generated/fragments/endpoints/anthropic-core.json
Last verified: 2026-09-18 (raws: tmp-live/anthropic-core/k1_complete_legacy.json, k2_complete_haiku.json)
Documented request
POST /v1/complete (x-api-key, anthropic-version: 2023-06-01, content-type: application/json, [anthropic-beta], [anthropic-workspace-id])| Field | Type | Req. | Notes |
|---|---|---|---|
model |
string | yes | reference enum lists current ids, but no current model serves this endpoint |
prompt |
string (min 1) | yes | must alternate \n\nHuman: …\n\nAssistant: turns |
max_tokens_to_sample |
integer ≥1 | yes | equivalent of max_tokens |
stop_sequences |
string[] | no | model always stops on \n\nHuman: |
stream |
boolean | no | SSE completion events (incremental since 2023-06-01) |
temperature / top_p / top_k |
number | no | same deprecated semantics as Messages |
metadata.user_id |
string ≤512 | no |
Documented response
{"id": "compl_018CKm6gsux7P8yMcwZbeCPw", "type": "completion", "completion": " Hello! My name is Claude.", "model": "claude-2.1", "stop_reason": "stop_sequence"}stop_reason: stop_sequence (yours or the built-in \n\nHuman:) | max_tokens. No usage object.
Live result (2026-09-18)
{"type":"error","error":{"type":"invalid_request_error","message":"The /v1/complete endpoint has been deprecated. Please use the /v1/messages endpoint instead. See https://platform.claude.com/docs/en/api/messages for details."},"request_id":"req_011CfBxeT7j1hh51N3Lv1Phn"}HTTP 400 for both claude-2.1 and claude-haiku-4-5-20251001; x-should-retry: false.
SDK support
| SDK | State |
|---|---|
Python anthropic 1.7.0 |
client.completions removed (AttributeError) — v1 migration dropped it |
TypeScript @anthropic-ai/sdk 0.126.0 |
client.completions.create({model, prompt, max_tokens_to_sample, stream?}) still typed; live → BadRequestError 400 |
CLI ant |
no completions resource documented |
Migration to Messages
| Text Completions | Messages |
|---|---|
prompt: "\n\nHuman: X\n\nAssistant:" |
messages: [{"role": "user", "content": "X"}] |
system text before the first Human: |
top-level system |
max_tokens_to_sample |
max_tokens |
"\n\nAssistant: prefix" prefill |
trailing assistant message (rejected on Claude 4.6+ → use output_config.format / instructions) |
completion string |
content[0].text |
stop_reason: stop_sequence (built-in) |
end_turn; custom → stop_sequence + stop_sequence field |
SSE completion events |
message_start / content_block_delta … (docs/anthropic/streaming.md) |
Examples: examples/anthropic/messages/legacy_complete.{sh,py,ts} (all demonstrate the 400).