ChatGPT · Example Payload

Chatgpt Createchatcompletion Example

AgentsArtificial IntelligenceChatGPTEmbeddingsFine-TuningGPT-4GPT-5Language ModelOpenAIReal-Time

Chatgpt Createchatcompletion Example is an example object payload from ChatGPT, with 6 top-level fields. It illustrates the shape of data this provider's APIs accept or return.

Top-level fields

operationIdmethodpathsummaryrequestExamplesresponseExamples

Example Payload

Raw ↑
{
  "operationId": "createChatCompletion",
  "method": "POST",
  "path": "/chat/completions",
  "summary": "Chatgpt Create Chat Completion",
  "requestExamples": [
    {
      "contentType": "application/json",
      "name": "BasicCompletion",
      "example": {
        "model": "gpt-4o",
        "messages": [
          {
            "role": "system",
            "content": "You are a helpful assistant."
          },
          {
            "role": "user",
            "content": "Hello!"
          }
        ]
      }
    },
    {
      "contentType": "application/json",
      "name": "WithTemperature",
      "example": {
        "model": "gpt-4o",
        "messages": [
          {
            "role": "user",
            "content": "Write a haiku about programming."
          }
        ],
        "temperature": 0.7,
        "max_completion_tokens": 150
      }
    },
    {
      "contentType": "application/json",
      "name": "WithToolCalling",
      "example": {
        "model": "gpt-4o",
        "messages": [
          {
            "role": "user",
            "content": "What is the weather in San Francisco?"
          }
        ],
        "tools": [
          {
            "type": "function",
            "function": {
              "name": "get_weather",
              "description": "Get the current weather in a given location",
              "parameters": {
                "type": "object",
                "properties": {
                  "location": {
                    "type": "string",
                    "description": "The city and state"
                  }
                },
                "required": [
                  "location"
                ]
              }
            }
          }
        ],
        "tool_choice": "auto"
      }
    }
  ],
  "responseExamples": [
    {
      "status": "200",
      "contentType": "application/json",
      "name": "BasicResponse",
      "example": {
        "id": "chatcmpl-abc123",
        "object": "chat.completion",
        "created": 1709123456,
        "model": "gpt-4o-2024-08-06",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "Hello! How can I help you today?"
            },
            "finish_reason": "stop"
          }
        ],
        "usage": {
          "prompt_tokens": 19,
          "completion_tokens": 10,
          "total_tokens": 29
        },
        "system_fingerprint": "fp_abc123"
      }
    },
    {
      "status": "400",
      "contentType": "application/json",
      "name": "Createchatcompletion400Example",
      "example": {
        "error": {
          "message": "example_value",
          "type": "example_value",
          "param": "example_value",
          "code": "example_value"
        }
      }
    },
    {
      "status": "401",
      "contentType": "application/json",
      "name": "Createchatcompletion401Example",
      "example": {
        "error": {
          "message": "example_value",
          "type": "example_value",
          "param": "example_value",
          "code": "example_value"
        }
      }
    },
    {
      "status": "429",
      "contentType": "application/json",
      "name": "Createchatcompletion429Example",
      "example": {
        "error": {
          "message": "example_value",
          "type": "example_value",
          "param": "example_value",
          "code": "example_value"
        }
      }
    },
    {
      "status": "500",
      "contentType": "application/json",
      "name": "Createchatcompletion500Example",
      "example": {
        "error": {
          "message": "example_value",
          "type": "example_value",
          "param": "example_value",
          "code": "example_value"
        }
      }
    }
  ]
}

Work with this as data

Every example here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for examples

4 MCP tools reach this
  • find_examplesBrowse and filter every example in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This example
curl "https://apis.io/api/v1/examples/chatgpt-createchatcompletion-example"
All examples
curl "https://apis.io/api/v1/examples?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.