便携AI网
AI的百科全书

便携AI聚合API gpt-5-pro调用方法,官方API,非逆向

GPT-5 Pro是OpenAI开发的GPT-5模型的高级变体,支持更深度的思考,专为需要深度推理、复杂任务和高精度输出的场景设计,8月正式登录ChatGPT,10月6日推出API版本,模型名字:gpt-5-pro、gpt-5-pro-2025-10-06,便携AI聚合API已经支持最新版GPT-5 Pro官方API,分享下具体的使用方法。

一、GPT-5 Pro介绍

GPT-5是统一系统的基础版,包含智能路由器自动切换“快速模式”和“思考模式”;而GPT-5 Pro是专属的“深度模式”,强制高计算投入,适合专业用户,其特点如下:

  • 增强推理能力:默认启用高强度推理模式(reasoning.effort: high),支持更长的思考链(chain of thought)和多步问题求解,特别适合复杂科学、数学、编码和数据分析任务。在GPQA(研究生级物理问题基准)上准确率达88.4%,显著优于前代模型如GPT-4o或o3。
  • 上下文与输出限制:最大输出令牌数高达272,000(比标准GPT-5的128,000更多),支持处理大型代码库、长文档或多文件项目,但响应时间较长(有时需5分钟以上)

GPT-5 Pro的优化领域:

  • 编码:擅长前端开发、调试大型仓库,甚至从单一提示生成美观的应用或游戏。
  • 健康与专业咨询:在HealthBench基准上得分最高,能像“思想伙伴”一样主动澄清问题,提供更准确的医疗相关建议(但不替代专业医生)。
  • 高风险工作流:适用于企业级分析、自动化和工具集成,但可能在创意写作等非结构化任务上表现不如标准模型。

GPT-5 Pro价格如下:

  • 输入token:$15/1M tokens
  • 输出token:$120/1M tokens

二、GTP-5 Pro使用方法

GPT-5 Pro模型名称:gpt-5-pro、gpt-5-pro-2025-10-06

GPT-5 Pro只能使用Responses API,传统的Chat Completions API无法调用。

下面以Python为例,介绍下如何调用gpt-5-pro-2025-10-06。示例中的api_key可以在网站后台获取,获取方法:《便携AI聚合API新建令牌(API key)教程》。

1、OpenAI包调用

def response_openai():
    from openai import OpenAI
    client = OpenAI(
        api_key=api_key,
        base_url=f'https://api.bianxie.ai/v1'
    )

    response = client.responses.create(
        model="gpt-5-pro",
        input="Write a one-sentence bedtime story about a unicorn."
    )

    print(response.json())

返回示例:

{
    "id": "resp_0475cbe93c291ac20068f59525f7fc8194b96dd61b82534c4d",
    "created_at": 1760924965,
    "error": null,
    "incomplete_details": null,
    "instructions": null,
    "metadata": {

    },
    "model": "gpt-5-pro",
    "object": "response",
    "output": [
        {
            "id": "rs_0475cbe93c291ac20068f5955964888194853336e2dc13e56d",
            "summary": [

            ],
            "type": "reasoning",
            "status": null
        },
        {
            "id": "msg_0475cbe93c291ac20068f59559653c8194804e60376d79d93d",
            "content": [
                {
                    "annotations": [

                    ],
                    "text": "Beneath a sky of sleepy stars, a gentle unicorn tiptoed across the clouds, stitching moonbeams into a soft ribbon that tucked the world in for the night.",
                    "type": "output_text",
                    "logprobs": [

                    ]
                }
            ],
            "role": "assistant",
            "status": "completed",
            "type": "message"
        }
    ],
    "parallel_tool_calls": true,
    "temperature": 1,
    "tool_choice": "auto",
    "tools": [

    ],
    "top_p": 1,
    "max_output_tokens": null,
    "previous_response_id": null,
    "reasoning": {
        "effort": "high",
        "generate_summary": null,
        "summary": null
    },
    "service_tier": "default",
    "status": "completed",
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "truncation": "disabled",
    "usage": {
        "input_tokens": 17,
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "output_tokens": 362,
        "output_tokens_details": {
            "reasoning_tokens": 320
        },
        "total_tokens": 379
    },
    "user": null,
    "background": false,
    "content_filters": null,
    "max_tool_calls": null,
    "prompt_cache_key": null,
    "safety_identifier": null,
    "store": true,
    "top_logprobs": 0
}

2、curl调用

def response_curl():
    import requests

    url = f"https://api.bianxie.ai/v1/responses"
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {api_key}"
    }
    data = {
        "model": "gpt-5-pro",
        "input": "Write a one-sentence bedtime story about a unicorn."
    }

    response = requests.post(url, headers=headers, json=data)

    print(response.json())

返回示例:

{
  "id": "resp_09f3f6f6fa328b520068f595b9b90c8195a39c3a534f9969e7",
  "object": "response",
  "created_at": 1760925113,
  "status": "completed",
  "background": false,
  "content_filters": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-5-pro",
  "output": [
    {
      "id": "rs_09f3f6f6fa328b520068f595ef318881959f086641583e6784",
      "type": "reasoning",
      "summary": []
    },
    {
      "id": "msg_09f3f6f6fa328b520068f595ef322c81959ee52c886a3f6d09",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "logprobs": [],
          "text": "As moonlight pooled over the meadow, a gentle unicorn stitched fallen stars into a glowing blanket and tucked the world in, humming the softest lullaby of dreams."
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "reasoning": {
    "effort": "high",
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "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": 17,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 423,
    "output_tokens_details": {
      "reasoning_tokens": 384
    },
    "total_tokens": 440
  },
  "user": null,
  "metadata": {}
}
赞(0)
未经允许不得转载:便携AI » 便携AI聚合API gpt-5-pro调用方法,官方API,非逆向