List Chat Completions

GEThttps:/api.openai.com/v1/chat/completions

List stored Chat Completions. Only Chat Completions that have been stored with the store parameter set to true will be returned.

Query parameters

  • model
    string
    The model used to generate the Chat Completions.
  • metadata
    object or null

    A list of metadata keys to filter the Chat Completions by. Example:

    metadata[key1]=value1&metadata[key2]=value2

  • after
    string
    Identifier for the last chat completion from the previous pagination request.
  • limit
    integer
    Defaults: 20
    Number of Chat Completions to retrieve.
  • order
    string
    Defaults: asc

    Sort order for Chat Completions by timestamp. Use asc for ascending order or desc for descending order. Defaults to asc.

Response

A list of Chat Completions matching the specified filters.

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