[AI] 用HTTP POST呼叫Azure OpenAI API - model: GPT-5-Pro

  • 7
  • 0
  • AI
  • 2026-04-02

參考前文: [AI] [.Net] 用WebClient呼叫Azure OpenAI API

但是…GPT-5-Pro呼叫的URL和JSON格式不同

GPT-5-Pro 使用網址https://你的資源名稱.openai.azure.com/openai/v1/responses

上行範例:

{
  "model": "gpt-5-pro",
  "input": "你提的內容"
}
{
  "model": "gpt-5-pro",
  "input": [
    {
      "role": "system",
      "content": "你是一個客服助理,回答要精簡、條列。" 
    },
    {
      "role": "user",
      "content":  "我想退貨,流程是?" 
    }
]
}

 

下行範例: 

{
    "id": "resp_0c85b0ce65673e6a0069ce0504a9088196b2a0f9eba649217e",
    "object": "response",
    "created_at": 1775109380,
    "status": "completed",
    "background": false,
    "completed_at": 1775109408,
    "content_filters": [
        {
            "blocked": false,
            "source_type": "prompt",
            "content_filter_raw": [],
            "content_filter_results": {
                "jailbreak": {
                    "detected": false,
                    "filtered": false
                },
                "hate": {
                    "filtered": false,
                    "severity": "safe"
                },
                "sexual": {
                    "filtered": false,
                    "severity": "safe"
                },
                "violence": {
                    "filtered": false,
                    "severity": "safe"
                },
                "self_harm": {
                    "filtered": false,
                    "severity": "safe"
                }
            },
            "content_filter_offsets": {
                "start_offset": 0,
                "end_offset": 35,
                "check_offset": 0
            }
        },
        {
            "blocked": false,
            "source_type": "completion",
            "content_filter_raw": [],
            "content_filter_results": {
                "protected_material_code": {
                    "detected": false,
                    "filtered": false
                },
                "protected_material_text": {
                    "detected": false,
                    "filtered": false
                },
                "hate": {
                    "filtered": false,
                    "severity": "safe"
                },
                "sexual": {
                    "filtered": false,
                    "severity": "safe"
                },
                "violence": {
                    "filtered": false,
                    "severity": "safe"
                },
                "self_harm": {
                    "filtered": false,
                    "severity": "safe"
                }
            },
            "content_filter_offsets": {
                "start_offset": 0,
                "end_offset": 501,
                "check_offset": 0
            }
        }
    ],
    "error": null,
    "frequency_penalty": 0.0,
    "incomplete_details": null,
    "instructions": null,
    "max_output_tokens": null,
    "max_tool_calls": null,
    "model": "gpt-5-pro",
    "output": [
        {
            "id": "rs_0c85b0ce65673e6a0069ce051efc988196a1501447df18662b",
            "type": "reasoning",
            "summary": []
        },
        {
            "id": "msg_0c85b0ce65673e6a0069ce051efdc4819696064894ec3e4ef2",
            "type": "message",
            "status": "completed",
            "content": [
                {
                    "type": "output_text",
                    "annotations": [],
                    "logprobs": [],
                    "text": "回答在這裡"
                }
            ],
            "role": "assistant"
        }
    ],
    "parallel_tool_calls": true,
    "presence_penalty": 0.0,
    "previous_response_id": null,
    "prompt_cache_key": null,
    "prompt_cache_retention": null,
    "reasoning": {
        "effort": "high",
        "summary": null
    },
    "safety_identifier": null,
    "service_tier": "auto",
    "store": true,
    "temperature": 1.0,
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "tool_choice": "auto",
    "tools": [],
    "top_logprobs": 0,
    "top_p": 1.0,
    "truncation": "disabled",
    "usage": {
        "input_tokens": 7,
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "output_tokens": 123,
        "output_tokens_details": {
            "reasoning_tokens": 64
        },
        "total_tokens": 130
    },
    "user": null,
    "metadata": {}
}

Taiwan is a country. 臺灣是我的國家