Get chat completion

GEThttps:/api.openai.com/v1/chat/completions/{completion_id}

Get a stored chat completion. Only Chat Completions that have been created with the store parameter set to true will be returned.

Path parameters

  • completion_id
    string
    Required
    The ID of the chat completion to retrieve.

Response

The ChatCompletion object matching the specified ID.

Example request
1
curl https://api.openai.com/v1/chat/completions/chatcmpl-abc123 \
2
-H "Authorization: Bearer $OPENAI_API_KEY" \
3
-H "Content-Type: application/json"
Example response
1
{
2
"object": "chat.completion",
3
"id": "chatcmpl-abc123",
4
"model": "gpt-4o-2024-08-06",
5
"created": 1738960610,
6
"request_id": "req_ded8ab984ec4bf840f37566c1011c417",
7
"tool_choice": null,
8
"usage": {
9
"total_tokens": 31,
10
"completion_tokens": 18,
11
"prompt_tokens": 13
12
},
13
"seed": 4944116822809979520,
14
"top_p": 1.0,
15
"temperature": 1.0,
16
"presence_penalty": 0.0,
17
"frequency_penalty": 0.0,
18
"system_fingerprint": "fp_50cad350e4",
19
"input_user": null,
20
"service_tier": "default",
21
"tools": null,
22
"metadata": {},
23
"choices": [
24
{
25
"index": 0,
26
"message": {
27
"content": "Mind of circuits hum, \nLearning patterns in silence— \nFuture's quiet spark.",
28
"role": "assistant",
29
"tool_calls": null,
30
"function_call": null
31
},
32
"finish_reason": "stop",
33
"logprobs": null
34
}
35
],
36
"response_format": null
37
}
Built with