resources/chat/index.md +1122 −55
743 743
744 - `"audio"`744 - `"audio"`
745 745
746- `moderation: optional object { model }`
747
748 Configuration for running moderation on the request input and generated output.
749
750 - `model: string`
751
752 The moderation model to use for moderated completions, e.g. 'omni-moderation-latest'.
753
746- `n: optional number`754- `n: optional number`
747 755
748 How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.756 How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs.
1274 1282
1275### Returns1283### Returns
1276 1284
12771285- `ChatCompletion object { id, choices, created, 5 more }`- `ChatCompletion object { id, choices, created, 6 more }`
1278 1286
1279 Represents a chat completion response returned by model, based on the provided input.1287 Represents a chat completion response returned by model, based on the provided input.
1280 1288
1292 `length` if the maximum number of tokens specified in the request was reached,1300 `length` if the maximum number of tokens specified in the request was reached,
1293 `content_filter` if content was omitted due to a flag from our content filters,1301 `content_filter` if content was omitted due to a flag from our content filters,
1294 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.1302 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
1303 Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.
1295 1304
1296 - `"stop"`1305 - `"stop"`
1297 1306
1518 1527
1519 - `"chat.completion"`1528 - `"chat.completion"`
1520 1529
1530 - `moderation: optional object { input, output }`
1531
1532 Moderation results for the request input and generated output, if moderated
1533 completions were requested.
1534
1535 - `input: object { model, results, type } or object { code, message, type }`
1536
1537 Moderation for the request input.
1538
1539 - `ModerationResults object { model, results, type }`
1540
1541 Successful moderation results for the request input or generated output.
1542
1543 - `model: string`
1544
1545 The moderation model used to generate the results.
1546
1547 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
1548
1549 A list of moderation results.
1550
1551 - `categories: map[boolean]`
1552
1553 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
1554
1555 - `category_applied_input_types: map[array of "text" or "image"]`
1556
1557 Which modalities of input are reflected by the score for each category.
1558
1559 - `"text"`
1560
1561 - `"image"`
1562
1563 - `category_scores: map[number]`
1564
1565 A dictionary of moderation categories to scores.
1566
1567 - `flagged: boolean`
1568
1569 A boolean indicating whether the content was flagged by any category.
1570
1571 - `model: string`
1572
1573 The moderation model that produced this result.
1574
1575 - `type: "moderation_result"`
1576
1577 The object type, which was always `moderation_result` for successful moderation results.
1578
1579 - `"moderation_result"`
1580
1581 - `type: "moderation_results"`
1582
1583 The object type, which is always `moderation_results`.
1584
1585 - `"moderation_results"`
1586
1587 - `Error object { code, message, type }`
1588
1589 An error produced while attempting moderation.
1590
1591 - `code: string`
1592
1593 The error code.
1594
1595 - `message: string`
1596
1597 The error message.
1598
1599 - `type: "error"`
1600
1601 The object type, which is always `error`.
1602
1603 - `"error"`
1604
1605 - `output: object { model, results, type } or object { code, message, type }`
1606
1607 Moderation for the generated output.
1608
1609 - `ModerationResults object { model, results, type }`
1610
1611 Successful moderation results for the request input or generated output.
1612
1613 - `model: string`
1614
1615 The moderation model used to generate the results.
1616
1617 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
1618
1619 A list of moderation results.
1620
1621 - `categories: map[boolean]`
1622
1623 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
1624
1625 - `category_applied_input_types: map[array of "text" or "image"]`
1626
1627 Which modalities of input are reflected by the score for each category.
1628
1629 - `"text"`
1630
1631 - `"image"`
1632
1633 - `category_scores: map[number]`
1634
1635 A dictionary of moderation categories to scores.
1636
1637 - `flagged: boolean`
1638
1639 A boolean indicating whether the content was flagged by any category.
1640
1641 - `model: string`
1642
1643 The moderation model that produced this result.
1644
1645 - `type: "moderation_result"`
1646
1647 The object type, which was always `moderation_result` for successful moderation results.
1648
1649 - `"moderation_result"`
1650
1651 - `type: "moderation_results"`
1652
1653 The object type, which is always `moderation_results`.
1654
1655 - `"moderation_results"`
1656
1657 - `Error object { code, message, type }`
1658
1659 An error produced while attempting moderation.
1660
1661 - `code: string`
1662
1663 The error code.
1664
1665 - `message: string`
1666
1667 The error message.
1668
1669 - `type: "error"`
1670
1671 The object type, which is always `error`.
1672
1673 - `"error"`
1674
1521 - `service_tier: optional "auto" or "default" or "flex" or 2 more`1675 - `service_tier: optional "auto" or "default" or "flex" or 2 more`
1522 1676
1523 Specifies the processing type used for serving the request.1677 Specifies the processing type used for serving the request.
1709 "created": 0,1863 "created": 0,
1710 "model": "model",1864 "model": "model",
1711 "object": "chat.completion",1865 "object": "chat.completion",
1866 "moderation": {
1867 "input": {
1868 "model": "model",
1869 "results": [
1870 {
1871 "categories": {
1872 "foo": true
1873 },
1874 "category_applied_input_types": {
1875 "foo": [
1876 "text"
1877 ]
1878 },
1879 "category_scores": {
1880 "foo": 0
1881 },
1882 "flagged": true,
1883 "model": "model",
1884 "type": "moderation_result"
1885 }
1886 ],
1887 "type": "moderation_results"
1888 },
1889 "output": {
1890 "model": "model",
1891 "results": [
1892 {
1893 "categories": {
1894 "foo": true
1895 },
1896 "category_applied_input_types": {
1897 "foo": [
1898 "text"
1899 ]
1900 },
1901 "category_scores": {
1902 "foo": 0
1903 },
1904 "flagged": true,
1905 "model": "model",
1906 "type": "moderation_result"
1907 }
1908 ],
1909 "type": "moderation_results"
1910 }
1911 },
1712 "service_tier": "auto",1912 "service_tier": "auto",
1713 "system_fingerprint": "system_fingerprint",1913 "system_fingerprint": "system_fingerprint",
1714 "usage": {1914 "usage": {
2244 `length` if the maximum number of tokens specified in the request was reached,2444 `length` if the maximum number of tokens specified in the request was reached,
2245 `content_filter` if content was omitted due to a flag from our content filters,2445 `content_filter` if content was omitted due to a flag from our content filters,
2246 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.2446 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
2447 Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.
2247 2448
2248 - `"stop"`2449 - `"stop"`
2249 2450
2470 2671
2471 - `"chat.completion"`2672 - `"chat.completion"`
2472 2673
2674 - `moderation: optional object { input, output }`
2675
2676 Moderation results for the request input and generated output, if moderated
2677 completions were requested.
2678
2679 - `input: object { model, results, type } or object { code, message, type }`
2680
2681 Moderation for the request input.
2682
2683 - `ModerationResults object { model, results, type }`
2684
2685 Successful moderation results for the request input or generated output.
2686
2687 - `model: string`
2688
2689 The moderation model used to generate the results.
2690
2691 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
2692
2693 A list of moderation results.
2694
2695 - `categories: map[boolean]`
2696
2697 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
2698
2699 - `category_applied_input_types: map[array of "text" or "image"]`
2700
2701 Which modalities of input are reflected by the score for each category.
2702
2703 - `"text"`
2704
2705 - `"image"`
2706
2707 - `category_scores: map[number]`
2708
2709 A dictionary of moderation categories to scores.
2710
2711 - `flagged: boolean`
2712
2713 A boolean indicating whether the content was flagged by any category.
2714
2715 - `model: string`
2716
2717 The moderation model that produced this result.
2718
2719 - `type: "moderation_result"`
2720
2721 The object type, which was always `moderation_result` for successful moderation results.
2722
2723 - `"moderation_result"`
2724
2725 - `type: "moderation_results"`
2726
2727 The object type, which is always `moderation_results`.
2728
2729 - `"moderation_results"`
2730
2731 - `Error object { code, message, type }`
2732
2733 An error produced while attempting moderation.
2734
2735 - `code: string`
2736
2737 The error code.
2738
2739 - `message: string`
2740
2741 The error message.
2742
2743 - `type: "error"`
2744
2745 The object type, which is always `error`.
2746
2747 - `"error"`
2748
2749 - `output: object { model, results, type } or object { code, message, type }`
2750
2751 Moderation for the generated output.
2752
2753 - `ModerationResults object { model, results, type }`
2754
2755 Successful moderation results for the request input or generated output.
2756
2757 - `model: string`
2758
2759 The moderation model used to generate the results.
2760
2761 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
2762
2763 A list of moderation results.
2764
2765 - `categories: map[boolean]`
2766
2767 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
2768
2769 - `category_applied_input_types: map[array of "text" or "image"]`
2770
2771 Which modalities of input are reflected by the score for each category.
2772
2773 - `"text"`
2774
2775 - `"image"`
2776
2777 - `category_scores: map[number]`
2778
2779 A dictionary of moderation categories to scores.
2780
2781 - `flagged: boolean`
2782
2783 A boolean indicating whether the content was flagged by any category.
2784
2785 - `model: string`
2786
2787 The moderation model that produced this result.
2788
2789 - `type: "moderation_result"`
2790
2791 The object type, which was always `moderation_result` for successful moderation results.
2792
2793 - `"moderation_result"`
2794
2795 - `type: "moderation_results"`
2796
2797 The object type, which is always `moderation_results`.
2798
2799 - `"moderation_results"`
2800
2801 - `Error object { code, message, type }`
2802
2803 An error produced while attempting moderation.
2804
2805 - `code: string`
2806
2807 The error code.
2808
2809 - `message: string`
2810
2811 The error message.
2812
2813 - `type: "error"`
2814
2815 The object type, which is always `error`.
2816
2817 - `"error"`
2818
2473 - `service_tier: optional "auto" or "default" or "flex" or 2 more`2819 - `service_tier: optional "auto" or "default" or "flex" or 2 more`
2474 2820
2475 Specifies the processing type used for serving the request.2821 Specifies the processing type used for serving the request.
2665 "created": 0,3011 "created": 0,
2666 "model": "model",3012 "model": "model",
2667 "object": "chat.completion",3013 "object": "chat.completion",
3014 "moderation": {
3015 "input": {
3016 "model": "model",
3017 "results": [
3018 {
3019 "categories": {
3020 "foo": true
3021 },
3022 "category_applied_input_types": {
3023 "foo": [
3024 "text"
3025 ]
3026 },
3027 "category_scores": {
3028 "foo": 0
3029 },
3030 "flagged": true,
3031 "model": "model",
3032 "type": "moderation_result"
3033 }
3034 ],
3035 "type": "moderation_results"
3036 },
3037 "output": {
3038 "model": "model",
3039 "results": [
3040 {
3041 "categories": {
3042 "foo": true
3043 },
3044 "category_applied_input_types": {
3045 "foo": [
3046 "text"
3047 ]
3048 },
3049 "category_scores": {
3050 "foo": 0
3051 },
3052 "flagged": true,
3053 "model": "model",
3054 "type": "moderation_result"
3055 }
3056 ],
3057 "type": "moderation_results"
3058 }
3059 },
2668 "service_tier": "auto",3060 "service_tier": "auto",
2669 "system_fingerprint": "system_fingerprint",3061 "system_fingerprint": "system_fingerprint",
2670 "usage": {3062 "usage": {
2762 3154
2763### Returns3155### Returns
2764 3156
27653157- `ChatCompletion object { id, choices, created, 5 more }`- `ChatCompletion object { id, choices, created, 6 more }`
2766 3158
2767 Represents a chat completion response returned by model, based on the provided input.3159 Represents a chat completion response returned by model, based on the provided input.
2768 3160
2780 `length` if the maximum number of tokens specified in the request was reached,3172 `length` if the maximum number of tokens specified in the request was reached,
2781 `content_filter` if content was omitted due to a flag from our content filters,3173 `content_filter` if content was omitted due to a flag from our content filters,
2782 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.3174 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
3175 Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.
2783 3176
2784 - `"stop"`3177 - `"stop"`
2785 3178
3006 3399
3007 - `"chat.completion"`3400 - `"chat.completion"`
3008 3401
30093402 - `service_tier: optional "auto" or "default" or "flex" or 2 more` - `moderation: optional object { input, output }`
3010 3403
30113404 Specifies the processing type used for serving the request. Moderation results for the request input and generated output, if moderated
3405 completions were requested.
3012 3406
30133407 - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - `input: object { model, results, type } or object { code, message, type }`
3014 - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
3015 - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.
3016 - When not set, the default behavior is 'auto'.
3017 3408
30183409 When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter. Moderation for the request input.
3019 3410
30203411 - `"auto"` - `ModerationResults object { model, results, type }`
3021 3412
30223413 - `"default"` Successful moderation results for the request input or generated output.
3023 3414
30243415 - `"flex"` - `model: string`
3025 3416
30263417 - `"scale"` The moderation model used to generate the results.
3027 3418
30283419 - `"priority"` - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
3029 3420
30303421 - `system_fingerprint: optional string` A list of moderation results.
3031 3422
30323423 This fingerprint represents the backend configuration that the model runs with. - `categories: map[boolean]`
3033 3424
30343425 Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. A dictionary of moderation categories to booleans, True if the input is flagged under this category.
3035 3426
30363427 - `usage: optional CompletionUsage` - `category_applied_input_types: map[array of "text" or "image"]`
3037 3428
30383429 Usage statistics for the completion request. Which modalities of input are reflected by the score for each category.
3039 3430
30403431 - `completion_tokens: number` - `"text"`
3041 3432
30423433 Number of tokens in the generated completion. - `"image"`
3043 3434
30443435 - `prompt_tokens: number` - `category_scores: map[number]`
3045 3436
30463437 Number of tokens in the prompt. A dictionary of moderation categories to scores.
3047 3438
30483439 - `total_tokens: number` - `flagged: boolean`
3049 3440
30503441 Total number of tokens used in the request (prompt + completion). A boolean indicating whether the content was flagged by any category.
3051 3442
30523443 - `completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, rejected_prediction_tokens }` - `model: string`
3053 3444
30543445 Breakdown of tokens used in a completion. The moderation model that produced this result.
3055 3446
30563447 - `accepted_prediction_tokens: optional number` - `type: "moderation_result"`
3057 3448
30583449 When using Predicted Outputs, the number of tokens in the The object type, which was always `moderation_result` for successful moderation results.
3059 prediction that appeared in the completion.
3060 3450
30613451 - `audio_tokens: optional number` - `"moderation_result"`
3062 3452
30633453 Audio input tokens generated by the model. - `type: "moderation_results"`
3064 3454
30653455 - `reasoning_tokens: optional number` The object type, which is always `moderation_results`.
3066 3456
30673457 Tokens generated by the model for reasoning. - `"moderation_results"`
3068 3458
30693459 - `rejected_prediction_tokens: optional number` - `Error object { code, message, type }`
3070 3460
30713461 When using Predicted Outputs, the number of tokens in the An error produced while attempting moderation.
3072 prediction that did not appear in the completion. However, like
3073 reasoning tokens, these tokens are still counted in the total
3074 completion tokens for purposes of billing, output, and context window
3075 limits.
3076 3462
30773463 - `prompt_tokens_details: optional object { audio_tokens, cached_tokens }` - `code: string`
3078 3464
30793465 Breakdown of tokens used in the prompt. The error code.
3080 3466
30813467 - `audio_tokens: optional number` - `message: string`
3082 3468
30833469 Audio input tokens present in the prompt. The error message.
3084 3470
30853471 - `cached_tokens: optional number` - `type: "error"`
3086 3472
30873473 Cached tokens present in the prompt. The object type, which is always `error`.
3088 3474
30893475### Example - `"error"`
3090 3476
30913477```http - `output: object { model, results, type } or object { code, message, type }`
3092curl https://api.openai.com/v1/chat/completions/$COMPLETION_ID \
3093 -H "Authorization: Bearer $OPENAI_API_KEY"
3094```
3095 3478
30963479#### Response Moderation for the generated output.
3480
3481 - `ModerationResults object { model, results, type }`
3482
3483 Successful moderation results for the request input or generated output.
3484
3485 - `model: string`
3486
3487 The moderation model used to generate the results.
3488
3489 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
3490
3491 A list of moderation results.
3492
3493 - `categories: map[boolean]`
3494
3495 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
3496
3497 - `category_applied_input_types: map[array of "text" or "image"]`
3498
3499 Which modalities of input are reflected by the score for each category.
3500
3501 - `"text"`
3502
3503 - `"image"`
3504
3505 - `category_scores: map[number]`
3506
3507 A dictionary of moderation categories to scores.
3508
3509 - `flagged: boolean`
3510
3511 A boolean indicating whether the content was flagged by any category.
3512
3513 - `model: string`
3514
3515 The moderation model that produced this result.
3516
3517 - `type: "moderation_result"`
3518
3519 The object type, which was always `moderation_result` for successful moderation results.
3520
3521 - `"moderation_result"`
3522
3523 - `type: "moderation_results"`
3524
3525 The object type, which is always `moderation_results`.
3526
3527 - `"moderation_results"`
3528
3529 - `Error object { code, message, type }`
3530
3531 An error produced while attempting moderation.
3532
3533 - `code: string`
3534
3535 The error code.
3536
3537 - `message: string`
3538
3539 The error message.
3540
3541 - `type: "error"`
3542
3543 The object type, which is always `error`.
3544
3545 - `"error"`
3546
3547 - `service_tier: optional "auto" or "default" or "flex" or 2 more`
3548
3549 Specifies the processing type used for serving the request.
3550
3551 - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.
3552 - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.
3553 - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.
3554 - When not set, the default behavior is 'auto'.
3555
3556 When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
3557
3558 - `"auto"`
3559
3560 - `"default"`
3561
3562 - `"flex"`
3563
3564 - `"scale"`
3565
3566 - `"priority"`
3567
3568 - `system_fingerprint: optional string`
3569
3570 This fingerprint represents the backend configuration that the model runs with.
3571
3572 Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
3573
3574 - `usage: optional CompletionUsage`
3575
3576 Usage statistics for the completion request.
3577
3578 - `completion_tokens: number`
3579
3580 Number of tokens in the generated completion.
3581
3582 - `prompt_tokens: number`
3583
3584 Number of tokens in the prompt.
3585
3586 - `total_tokens: number`
3587
3588 Total number of tokens used in the request (prompt + completion).
3589
3590 - `completion_tokens_details: optional object { accepted_prediction_tokens, audio_tokens, reasoning_tokens, rejected_prediction_tokens }`
3591
3592 Breakdown of tokens used in a completion.
3593
3594 - `accepted_prediction_tokens: optional number`
3595
3596 When using Predicted Outputs, the number of tokens in the
3597 prediction that appeared in the completion.
3598
3599 - `audio_tokens: optional number`
3600
3601 Audio input tokens generated by the model.
3602
3603 - `reasoning_tokens: optional number`
3604
3605 Tokens generated by the model for reasoning.
3606
3607 - `rejected_prediction_tokens: optional number`
3608
3609 When using Predicted Outputs, the number of tokens in the
3610 prediction that did not appear in the completion. However, like
3611 reasoning tokens, these tokens are still counted in the total
3612 completion tokens for purposes of billing, output, and context window
3613 limits.
3614
3615 - `prompt_tokens_details: optional object { audio_tokens, cached_tokens }`
3616
3617 Breakdown of tokens used in the prompt.
3618
3619 - `audio_tokens: optional number`
3620
3621 Audio input tokens present in the prompt.
3622
3623 - `cached_tokens: optional number`
3624
3625 Cached tokens present in the prompt.
3626
3627### Example
3628
3629```http
3630curl https://api.openai.com/v1/chat/completions/$COMPLETION_ID \
3631 -H "Authorization: Bearer $OPENAI_API_KEY"
3632```
3633
3634#### Response
3097 3635
3098```json3636```json
3099{3637{
3181 "created": 0,3719 "created": 0,
3182 "model": "model",3720 "model": "model",
3183 "object": "chat.completion",3721 "object": "chat.completion",
3722 "moderation": {
3723 "input": {
3724 "model": "model",
3725 "results": [
3726 {
3727 "categories": {
3728 "foo": true
3729 },
3730 "category_applied_input_types": {
3731 "foo": [
3732 "text"
3733 ]
3734 },
3735 "category_scores": {
3736 "foo": 0
3737 },
3738 "flagged": true,
3739 "model": "model",
3740 "type": "moderation_result"
3741 }
3742 ],
3743 "type": "moderation_results"
3744 },
3745 "output": {
3746 "model": "model",
3747 "results": [
3748 {
3749 "categories": {
3750 "foo": true
3751 },
3752 "category_applied_input_types": {
3753 "foo": [
3754 "text"
3755 ]
3756 },
3757 "category_scores": {
3758 "foo": 0
3759 },
3760 "flagged": true,
3761 "model": "model",
3762 "type": "moderation_result"
3763 }
3764 ],
3765 "type": "moderation_results"
3766 }
3767 },
3184 "service_tier": "auto",3768 "service_tier": "auto",
3185 "system_fingerprint": "system_fingerprint",3769 "system_fingerprint": "system_fingerprint",
3186 "usage": {3770 "usage": {
3276 3860
3277### Returns3861### Returns
3278 3862
32793863- `ChatCompletion object { id, choices, created, 5 more }`- `ChatCompletion object { id, choices, created, 6 more }`
3280 3864
3281 Represents a chat completion response returned by model, based on the provided input.3865 Represents a chat completion response returned by model, based on the provided input.
3282 3866
3294 `length` if the maximum number of tokens specified in the request was reached,3878 `length` if the maximum number of tokens specified in the request was reached,
3295 `content_filter` if content was omitted due to a flag from our content filters,3879 `content_filter` if content was omitted due to a flag from our content filters,
3296 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.3880 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
3881 Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.
3297 3882
3298 - `"stop"`3883 - `"stop"`
3299 3884
3520 4105
3521 - `"chat.completion"`4106 - `"chat.completion"`
3522 4107
4108 - `moderation: optional object { input, output }`
4109
4110 Moderation results for the request input and generated output, if moderated
4111 completions were requested.
4112
4113 - `input: object { model, results, type } or object { code, message, type }`
4114
4115 Moderation for the request input.
4116
4117 - `ModerationResults object { model, results, type }`
4118
4119 Successful moderation results for the request input or generated output.
4120
4121 - `model: string`
4122
4123 The moderation model used to generate the results.
4124
4125 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
4126
4127 A list of moderation results.
4128
4129 - `categories: map[boolean]`
4130
4131 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
4132
4133 - `category_applied_input_types: map[array of "text" or "image"]`
4134
4135 Which modalities of input are reflected by the score for each category.
4136
4137 - `"text"`
4138
4139 - `"image"`
4140
4141 - `category_scores: map[number]`
4142
4143 A dictionary of moderation categories to scores.
4144
4145 - `flagged: boolean`
4146
4147 A boolean indicating whether the content was flagged by any category.
4148
4149 - `model: string`
4150
4151 The moderation model that produced this result.
4152
4153 - `type: "moderation_result"`
4154
4155 The object type, which was always `moderation_result` for successful moderation results.
4156
4157 - `"moderation_result"`
4158
4159 - `type: "moderation_results"`
4160
4161 The object type, which is always `moderation_results`.
4162
4163 - `"moderation_results"`
4164
4165 - `Error object { code, message, type }`
4166
4167 An error produced while attempting moderation.
4168
4169 - `code: string`
4170
4171 The error code.
4172
4173 - `message: string`
4174
4175 The error message.
4176
4177 - `type: "error"`
4178
4179 The object type, which is always `error`.
4180
4181 - `"error"`
4182
4183 - `output: object { model, results, type } or object { code, message, type }`
4184
4185 Moderation for the generated output.
4186
4187 - `ModerationResults object { model, results, type }`
4188
4189 Successful moderation results for the request input or generated output.
4190
4191 - `model: string`
4192
4193 The moderation model used to generate the results.
4194
4195 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
4196
4197 A list of moderation results.
4198
4199 - `categories: map[boolean]`
4200
4201 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
4202
4203 - `category_applied_input_types: map[array of "text" or "image"]`
4204
4205 Which modalities of input are reflected by the score for each category.
4206
4207 - `"text"`
4208
4209 - `"image"`
4210
4211 - `category_scores: map[number]`
4212
4213 A dictionary of moderation categories to scores.
4214
4215 - `flagged: boolean`
4216
4217 A boolean indicating whether the content was flagged by any category.
4218
4219 - `model: string`
4220
4221 The moderation model that produced this result.
4222
4223 - `type: "moderation_result"`
4224
4225 The object type, which was always `moderation_result` for successful moderation results.
4226
4227 - `"moderation_result"`
4228
4229 - `type: "moderation_results"`
4230
4231 The object type, which is always `moderation_results`.
4232
4233 - `"moderation_results"`
4234
4235 - `Error object { code, message, type }`
4236
4237 An error produced while attempting moderation.
4238
4239 - `code: string`
4240
4241 The error code.
4242
4243 - `message: string`
4244
4245 The error message.
4246
4247 - `type: "error"`
4248
4249 The object type, which is always `error`.
4250
4251 - `"error"`
4252
3523 - `service_tier: optional "auto" or "default" or "flex" or 2 more`4253 - `service_tier: optional "auto" or "default" or "flex" or 2 more`
3524 4254
3525 Specifies the processing type used for serving the request.4255 Specifies the processing type used for serving the request.
3701 "created": 0,4431 "created": 0,
3702 "model": "model",4432 "model": "model",
3703 "object": "chat.completion",4433 "object": "chat.completion",
4434 "moderation": {
4435 "input": {
4436 "model": "model",
4437 "results": [
4438 {
4439 "categories": {
4440 "foo": true
4441 },
4442 "category_applied_input_types": {
4443 "foo": [
4444 "text"
4445 ]
4446 },
4447 "category_scores": {
4448 "foo": 0
4449 },
4450 "flagged": true,
4451 "model": "model",
4452 "type": "moderation_result"
4453 }
4454 ],
4455 "type": "moderation_results"
4456 },
4457 "output": {
4458 "model": "model",
4459 "results": [
4460 {
4461 "categories": {
4462 "foo": true
4463 },
4464 "category_applied_input_types": {
4465 "foo": [
4466 "text"
4467 ]
4468 },
4469 "category_scores": {
4470 "foo": 0
4471 },
4472 "flagged": true,
4473 "model": "model",
4474 "type": "moderation_result"
4475 }
4476 ],
4477 "type": "moderation_results"
4478 }
4479 },
3704 "service_tier": "auto",4480 "service_tier": "auto",
3705 "system_fingerprint": "system_fingerprint",4481 "system_fingerprint": "system_fingerprint",
3706 "usage": {4482 "usage": {
3843 4619
3844### Chat Completion4620### Chat Completion
3845 4621
38464622- `ChatCompletion object { id, choices, created, 5 more }`- `ChatCompletion object { id, choices, created, 6 more }`
3847 4623
3848 Represents a chat completion response returned by model, based on the provided input.4624 Represents a chat completion response returned by model, based on the provided input.
3849 4625
3861 `length` if the maximum number of tokens specified in the request was reached,4637 `length` if the maximum number of tokens specified in the request was reached,
3862 `content_filter` if content was omitted due to a flag from our content filters,4638 `content_filter` if content was omitted due to a flag from our content filters,
3863 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.4639 `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
4640 Read the [Model Spec](https://model-spec.openai.com/2025-12-18.html) for more.
3864 4641
3865 - `"stop"`4642 - `"stop"`
3866 4643
4087 4864
4088 - `"chat.completion"`4865 - `"chat.completion"`
4089 4866
4867 - `moderation: optional object { input, output }`
4868
4869 Moderation results for the request input and generated output, if moderated
4870 completions were requested.
4871
4872 - `input: object { model, results, type } or object { code, message, type }`
4873
4874 Moderation for the request input.
4875
4876 - `ModerationResults object { model, results, type }`
4877
4878 Successful moderation results for the request input or generated output.
4879
4880 - `model: string`
4881
4882 The moderation model used to generate the results.
4883
4884 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
4885
4886 A list of moderation results.
4887
4888 - `categories: map[boolean]`
4889
4890 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
4891
4892 - `category_applied_input_types: map[array of "text" or "image"]`
4893
4894 Which modalities of input are reflected by the score for each category.
4895
4896 - `"text"`
4897
4898 - `"image"`
4899
4900 - `category_scores: map[number]`
4901
4902 A dictionary of moderation categories to scores.
4903
4904 - `flagged: boolean`
4905
4906 A boolean indicating whether the content was flagged by any category.
4907
4908 - `model: string`
4909
4910 The moderation model that produced this result.
4911
4912 - `type: "moderation_result"`
4913
4914 The object type, which was always `moderation_result` for successful moderation results.
4915
4916 - `"moderation_result"`
4917
4918 - `type: "moderation_results"`
4919
4920 The object type, which is always `moderation_results`.
4921
4922 - `"moderation_results"`
4923
4924 - `Error object { code, message, type }`
4925
4926 An error produced while attempting moderation.
4927
4928 - `code: string`
4929
4930 The error code.
4931
4932 - `message: string`
4933
4934 The error message.
4935
4936 - `type: "error"`
4937
4938 The object type, which is always `error`.
4939
4940 - `"error"`
4941
4942 - `output: object { model, results, type } or object { code, message, type }`
4943
4944 Moderation for the generated output.
4945
4946 - `ModerationResults object { model, results, type }`
4947
4948 Successful moderation results for the request input or generated output.
4949
4950 - `model: string`
4951
4952 The moderation model used to generate the results.
4953
4954 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
4955
4956 A list of moderation results.
4957
4958 - `categories: map[boolean]`
4959
4960 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
4961
4962 - `category_applied_input_types: map[array of "text" or "image"]`
4963
4964 Which modalities of input are reflected by the score for each category.
4965
4966 - `"text"`
4967
4968 - `"image"`
4969
4970 - `category_scores: map[number]`
4971
4972 A dictionary of moderation categories to scores.
4973
4974 - `flagged: boolean`
4975
4976 A boolean indicating whether the content was flagged by any category.
4977
4978 - `model: string`
4979
4980 The moderation model that produced this result.
4981
4982 - `type: "moderation_result"`
4983
4984 The object type, which was always `moderation_result` for successful moderation results.
4985
4986 - `"moderation_result"`
4987
4988 - `type: "moderation_results"`
4989
4990 The object type, which is always `moderation_results`.
4991
4992 - `"moderation_results"`
4993
4994 - `Error object { code, message, type }`
4995
4996 An error produced while attempting moderation.
4997
4998 - `code: string`
4999
5000 The error code.
5001
5002 - `message: string`
5003
5004 The error message.
5005
5006 - `type: "error"`
5007
5008 The object type, which is always `error`.
5009
5010 - `"error"`
5011
4090 - `service_tier: optional "auto" or "default" or "flex" or 2 more`5012 - `service_tier: optional "auto" or "default" or "flex" or 2 more`
4091 5013
4092 Specifies the processing type used for serving the request.5014 Specifies the processing type used for serving the request.
4435 5357
4436### Chat Completion Chunk5358### Chat Completion Chunk
4437 5359
44385360- `ChatCompletionChunk object { id, choices, created, 5 more }`- `ChatCompletionChunk object { id, choices, created, 6 more }`
4439 5361
4440 Represents a streamed chunk of a chat completion response returned5362 Represents a streamed chunk of a chat completion response returned
4441 by the model, based on the provided input.5363 by the model, based on the provided input.
4603 5525
4604 - `"chat.completion.chunk"`5526 - `"chat.completion.chunk"`
4605 5527
5528 - `moderation: optional object { input, output }`
5529
5530 Moderation results for the request input and generated output. Present
5531 on the moderation chunk when moderated completions are requested.
5532
5533 - `input: object { model, results, type } or object { code, message, type }`
5534
5535 Moderation for the request input.
5536
5537 - `ModerationResults object { model, results, type }`
5538
5539 Successful moderation results for the request input or generated output.
5540
5541 - `model: string`
5542
5543 The moderation model used to generate the results.
5544
5545 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
5546
5547 A list of moderation results.
5548
5549 - `categories: map[boolean]`
5550
5551 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
5552
5553 - `category_applied_input_types: map[array of "text" or "image"]`
5554
5555 Which modalities of input are reflected by the score for each category.
5556
5557 - `"text"`
5558
5559 - `"image"`
5560
5561 - `category_scores: map[number]`
5562
5563 A dictionary of moderation categories to scores.
5564
5565 - `flagged: boolean`
5566
5567 A boolean indicating whether the content was flagged by any category.
5568
5569 - `model: string`
5570
5571 The moderation model that produced this result.
5572
5573 - `type: "moderation_result"`
5574
5575 The object type, which was always `moderation_result` for successful moderation results.
5576
5577 - `"moderation_result"`
5578
5579 - `type: "moderation_results"`
5580
5581 The object type, which is always `moderation_results`.
5582
5583 - `"moderation_results"`
5584
5585 - `Error object { code, message, type }`
5586
5587 An error produced while attempting moderation.
5588
5589 - `code: string`
5590
5591 The error code.
5592
5593 - `message: string`
5594
5595 The error message.
5596
5597 - `type: "error"`
5598
5599 The object type, which is always `error`.
5600
5601 - `"error"`
5602
5603 - `output: object { model, results, type } or object { code, message, type }`
5604
5605 Moderation for the generated output.
5606
5607 - `ModerationResults object { model, results, type }`
5608
5609 Successful moderation results for the request input or generated output.
5610
5611 - `model: string`
5612
5613 The moderation model used to generate the results.
5614
5615 - `results: array of object { categories, category_applied_input_types, category_scores, 3 more }`
5616
5617 A list of moderation results.
5618
5619 - `categories: map[boolean]`
5620
5621 A dictionary of moderation categories to booleans, True if the input is flagged under this category.
5622
5623 - `category_applied_input_types: map[array of "text" or "image"]`
5624
5625 Which modalities of input are reflected by the score for each category.
5626
5627 - `"text"`
5628
5629 - `"image"`
5630
5631 - `category_scores: map[number]`
5632
5633 A dictionary of moderation categories to scores.
5634
5635 - `flagged: boolean`
5636
5637 A boolean indicating whether the content was flagged by any category.
5638
5639 - `model: string`
5640
5641 The moderation model that produced this result.
5642
5643 - `type: "moderation_result"`
5644
5645 The object type, which was always `moderation_result` for successful moderation results.
5646
5647 - `"moderation_result"`
5648
5649 - `type: "moderation_results"`
5650
5651 The object type, which is always `moderation_results`.
5652
5653 - `"moderation_results"`
5654
5655 - `Error object { code, message, type }`
5656
5657 An error produced while attempting moderation.
5658
5659 - `code: string`
5660
5661 The error code.
5662
5663 - `message: string`
5664
5665 The error message.
5666
5667 - `type: "error"`
5668
5669 The object type, which is always `error`.
5670
5671 - `"error"`
5672
4606 - `service_tier: optional "auto" or "default" or "flex" or 2 more`5673 - `service_tier: optional "auto" or "default" or "flex" or 2 more`
4607 5674
4608 Specifies the processing type used for serving the request.5675 Specifies the processing type used for serving the request.