テキスト補完を作成
POST/v1/complete
[レガシー] テキスト補完を作成します。
Text Completions APIはレガシーAPIです。今後はMessages APIの使用をお勧めします。
将来のモデルや機能はText Completionsと互換性がありません。Text CompletionsからMessagesへの移行については、移行ガイドをご覧ください。
Headers
Body
Returns
テキスト補完を作成
curl https://api.anthropic.com/v1/complete \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
-H "X-Api-Key: $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"
}