apicheats.dev openai/llms.txt Raw .md
GET

GET /chat/completions — OpenAI API

OpenAI API key (required); https://api.openai.com/v1

OpenAI API

List Chat Completions

Base URL
https://api.openai.com/v1
Auth
Authorization: Bearer <OPENAI_API_KEY>
Last verified
2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 271 tokens · Vary: Accept

Critical gotchas

The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.

Audio transcription uploads use multipart form data rather than a JSON request body.

cURL

curl -X GET 'https://api.openai.com/v1/chat/completions?model=example-model&metadata=example-metadata&after=example-after&limit=20&order=asc' \  -H "Authorization: Bearer $OPENAI_API_KEY"

Parameters

Name In Type Required Description
model query string No The model used to generate the Chat Completions.
metadata query object No A list of metadata keys to filter the Chat Completions by. Example: `metadata[key1]=value1&metadata[key2]=value2`
after query string No Identifier for the last chat completion from the previous pagination request.
limit query integer No Number of Chat Completions to retrieve.
order query string No Sort order for Chat Completions by timestamp. Use `asc` for ascending order or `desc` for descending order. Defaults to `asc`.

Response 200 OK

{
  "object": "list",
  "data": [
    {
      "id": "string",
      "choices": [
        {
          "finish_reason": "stop",
          "index": 0,
          "message": {
            "content": "[recursive or deeply nested schema]",
            "refusal": "[recursive or deeply nested schema]",
            "tool_calls": "[recursive or deeply nested schema]",
            "annotations": "[recursive or deeply nested schema]",
            "role": "[recursive or deeply nested schema]",
            "function_call": "[recursive or deeply nested schema]",
            "audio": "[recursive or deeply nested schema]"
          },
          "logprobs": {
            "content": "[recursive or deeply nested schema]",
            "refusal": "[recursive or deeply nested schema]"
          }
        }
      ],
      "created": 0,
      "model": "string",
      "metadata": {},
      "service_tier": "auto",
      "system_fingerprint": "string",
      "object": "chat.completion",
      "usage": {
        "completion_tokens": 0,
        "prompt_tokens": 0,
        "total_tokens": 0,
        "completion_tokens_details": {
          "accepted_prediction_tokens": 0,
          "audio_tokens": 0,
          "reasoning_tokens": 0,
          "text_tokens": 0,
          "rejected_prediction_tokens": 0
        },
        "prompt_tokens_details": {
          "audio_tokens": 0,
          "cached_tokens": 0,
          "text_tokens": 0,
          "image_tokens": 0,
          "cache_write_tokens": 0
        }
      },
      "moderation": {
        "input": {
          "type": "moderation_results",
          "model": "string",
          "results": [
            "[recursive or deeply nested schema]"
          ]
        },
        "output": {
          "type": "moderation_results",
          "model": "string",
          "results": [
            "[recursive or deeply nested schema]"
          ]
        }
      }
    }
  ],
  "first_id": "string",
  "last_id": "string",
  "has_more": true
}
Get a free OpenAI API key → sponsored

Affiliate link - we may earn a commission, at no extra cost to you.