Skip to main content
Back to Prompts Library Reference response formats for the Chat Completions API. OpenAI and Azure OpenAI use identical response structures.

Tool Calling with Streaming

Streamed response when the model invokes a function call. Tokens are delivered incrementally; the final chunk includes usage data.
data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"role":"assistant","content":null,"function_call":{"name":"submit_Leave_Request","arguments":""},"refusal":null},"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"{\""}},{"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"employee"}},{"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"_id"}},{"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"\":\""}},{"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"10289"}},{"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"\",\""}},{"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{"function_call":{"arguments":"start_date\":\"10/10/2024\",\"end_date\":\"11/10/2024\",\"leave_type\":\"Sick Leave\"}"}}],"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"function_call"}],"usage":null}

data: {"id":"chatcmpl-AUvTWRuwCDIOINJf9oXmPSN2HTHTl","object":"chat.completion.chunk","created":1731934138,"model":"gpt-4o-2024-08-06","system_fingerprint":"fp_45cf54deae","choices":[],"usage":{"prompt_tokens":678,"completion_tokens":45,"total_tokens":723,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}}}

data: [DONE]

Tool Calling Response

Non-streaming response when the model invokes a function call. The full response is returned at once with finish_reason: "function_call".
{
    "id": "chatcmpl-Cb3WPT8H0oAbzpSvVYvMZcFOsVxtV",
    "object": "chat.completion",
    "created": 1762947709,
    "model": "gpt-4o-2024-08-06",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": null,
                "function_call": {
                    "name": "submit_Leave_Request",
                    "arguments": "{\"employee_id\":\"10289\",\"start_date\":\"10/10/2024\",\"end_date\":\"11/10/2024\",\"leave_type\":\"Sick Leave\"}"
                },
                "refusal": null,
                "annotations": []
            },
            "logprobs": null,
            "finish_reason": "function_call"
        }
    ],
    "usage": {
        "prompt_tokens": 678,
        "completion_tokens": 45,
        "total_tokens": 723,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "audio_tokens": 0
        },
        "completion_tokens_details": {
            "reasoning_tokens": 0,
            "audio_tokens": 0,
            "accepted_prediction_tokens": 0,
            "rejected_prediction_tokens": 0
        }
    },
    "service_tier": "default",
    "system_fingerprint": "fp_b1442291a8"
}

Streaming Response

Standard streaming response for text generation. Tokens are delivered incrementally; the final chunk includes usage data and finish_reason: "stop".
data: {"id":"chatcmpl-Cb3TzZQiYCBuCTaaYF4Ys0BRtZxTo","object":"chat.completion.chunk","created":1762947559,"model":"gpt-4-0613","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"role":"assistant","content":"","refusal":null},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":""}

data: {"id":"chatcmpl-Cb3TzZQiYCBuCTaaYF4Ys0BRtZxTo","object":"chat.completion.chunk","created":1762947559,"model":"gpt-4-0613","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"\"C"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"uDkAp8P7FzWBPiO"}

data: {"id":"chatcmpl-Cb3TzZQiYCBuCTaaYF4Ys0BRtZxTo","object":"chat.completion.chunk","created":1762947559,"model":"gpt-4-0613","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":"rypto"},"logprobs":null,"finish_reason":null}],"usage":null,"obfuscation":"NTMSChOhQMEvT"}

data: {"id":"chatcmpl-Cb3TzZQiYCBuCTaaYF4Ys0BRtZxTo","object":"chat.completion.chunk","created":1762947559,"model":"gpt-4-0613","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" is digital, decentralized, secure, borderless, and internet-based."},"logprobs":null,"finish_reason":null}],"usage":null}

data: {"id":"chatcmpl-Cb3TzZQiYCBuCTaaYF4Ys0BRtZxTo","object":"chat.completion.chunk","created":1762947559,"model":"gpt-4-0613","service_tier":"default","system_fingerprint":null,"choices":[{"index":0,"delta":{},"logprobs":null,"finish_reason":"stop"}],"usage":null,"obfuscation":"14p9foXAzlgm"}

data: {"id":"chatcmpl-Cb3TzZQiYCBuCTaaYF4Ys0BRtZxTo","object":"chat.completion.chunk","created":1762947559,"model":"gpt-4-0613","service_tier":"default","system_fingerprint":null,"choices":[],"usage":{"prompt_tokens":29,"completion_tokens":17,"total_tokens":46,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":0,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"obfuscation":"k"}

data: [DONE]

Regular Response

Standard non-streaming response. The full content is returned in a single JSON object with finish_reason: "stop".
{
    "id": "chatcmpl-Cb3Xgzd6Lqjr30wFgQGqjUdQ5wyOj",
    "object": "chat.completion",
    "created": 1762947788,
    "model": "gpt-4-0613",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Digital, decentralized, secure currency using blockchain for transactions' verification.",
                "refusal": null,
                "annotations": []
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 29,
        "completion_tokens": 13,
        "total_tokens": 42,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "audio_tokens": 0
        },
        "completion_tokens_details": {
            "reasoning_tokens": 0,
            "audio_tokens": 0,
            "accepted_prediction_tokens": 0,
            "rejected_prediction_tokens": 0
        }
    },
    "service_tier": "default",
    "system_fingerprint": null
}