Eine Text Completion erstellen
POST/v1/complete
Deprecated: Use the Messages API instead.
The
create method is not implemented in the CLI SDK, but it is available in the following languages: HTTP. The HTTP reference is shown below.[Veraltet] Eine Text Completion erstellen.
Die Text Completions API ist eine veraltete API. Wir empfehlen, künftig die Messages API zu verwenden.
Zukünftige Modelle und Funktionen werden nicht mit Text Completions kompatibel sein. In unserem Migrationsleitfaden findest du Hinweise zur Migration von Text Completions zu Messages.
Headers
Body
Returns
Eine Text Completion erstellen
curl https://api.anthropic.com/v1/complete \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2026-10-21' \
-H "Authorization: Bearer $ANTHROPIC_API_KEY" \
--max-time 600 \
-d '{
"max_tokens_to_sample": 256,
"model": "claude-2.1",
"prompt": "\n\nHuman: Hello, world!\n\nAssistant:",
"temperature": 1,
"top_k": 5,
"top_p": 0.7
}'Response 200
{
"id": "compl_018CKm6gsux7P8yMcwZbeCPw",
"completion": " Hello! My name is Claude.",
"model": "claude-2.1",
"stop_reason": "stop_sequence",
"type": "completion"
}Returns Examples
Response 200
{
"id": "compl_018CKm6gsux7P8yMcwZbeCPw",
"completion": " Hello! My name is Claude.",
"model": "claude-2.1",
"stop_reason": "stop_sequence",
"type": "completion"
}