{
"model": "gpt-4.1-mini",
"messages": [
{
"role": "system",
"content": "提取活动信息"
},
{
"role": "user",
"content": "爱丽丝和鲍勃将于星期五参加一个科学展览会。"
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "CalendarEvent",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"date": {
"type": "string"
},
"participants": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"date",
"participants"
],
"additionalProperties": false
}
}
}
}curl --location -g --request POST 'http://api.example.com/v1/chat/completions' \
--header 'Authorization: Bearer sk-xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gpt-4.1-mini",
"messages": [
{
"role": "system",
"content": "提取活动信息"
},
{
"role": "user",
"content": "爱丽丝和鲍勃将于星期五参加一个科学展览会。"
}
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "CalendarEvent",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"date": {
"type": "string"
},
"participants": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"name",
"date",
"participants"
],
"additionalProperties": false
}
}
}
}'{
"id": "chatcmpl-ChGNpvCnR03VcMS4q0bz2zOfnGQNV",
"object": "chat.completion",
"created": 1764427117,
"model": "gpt-4.1-mini-2025-04-14",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "{\"date\":\"星期五\",\"name\":\"科学展览会\",\"participants\":[\"爱丽丝\",\"鲍勃\"]}",
"refusal": null,
"annotations": []
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 82,
"completion_tokens": 25,
"total_tokens": 107,
"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_24710c7f06"
}