创建结构化输出

Structured Output

POST https://api.apizt.com/v1/chat/completions 在线调试 →

示例使用 gpt-6.1-sol。Chat 使用 reasoning_effort,仅接受 low/medium/high/xhigh/max;不要传 none 或 minimal。工具调用请改用 Responses 函数调用。

▼ Authorization

在 Header 添加参数 Authorization,其值为 Bearer 之后拼接 Token

示例: Authorization: Bearer ********************

请求参数

Header 参数
Authorizationstring必需
Bearer Token;从环境变量 tokenba_API_KEY 读取。
Content-Typestring必需
示例:application/json
Body 参数application/json
modelstring必需
示例:gpt-6.1-sol
messagesarray必需
结构见完整 JSON 示例。
response_formatobject可选
结构见完整 JSON 示例。
reasoning_effortstring可选
示例:low

完整 JSON 请求体

{
  "model": "gpt-6.1-sol",
  "messages": [
    {
      "role": "system",
      "content": "Determine if the user input violates specific guidelines and explain if they do."
    },
    {
      "role": "user",
      "content": "How do I prepare for a job interview?"
    }
  ],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "content_compliance",
      "description": "Determines if content is violating specific moderation rules",
      "schema": {
        "type": "object",
        "properties": {
          "is_violating": {
            "type": "boolean",
            "description": "Indicates if the content is violating guidelines"
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Type of violation, if the content is violating guidelines. Null otherwise.",
            "enum": [
              "violence",
              "sexual",
              "self_harm",
              null
            ]
          },
          "explanation_if_violating": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explanation of why the content is violating"
          }
        },
        "required": [
          "is_violating",
          "category",
          "explanation_if_violating"
        ],
        "additionalProperties": false
      },
      "strict": true
    }
  },
  "reasoning_effort": "low"
}

请求示例代码

curl --fail-with-body --request POST 'https://api.apizt.com/v1/chat/completions' \
  --header "Authorization: Bearer ${tokenba_API_KEY}" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "model": "gpt-6.1-sol",
  "messages": [
    {
      "role": "system",
      "content": "Determine if the user input violates specific guidelines and explain if they do."
    },
    {
      "role": "user",
      "content": "How do I prepare for a job interview?"
    }
  ],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "content_compliance",
      "description": "Determines if content is violating specific moderation rules",
      "schema": {
        "type": "object",
        "properties": {
          "is_violating": {
            "type": "boolean",
            "description": "Indicates if the content is violating guidelines"
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Type of violation, if the content is violating guidelines. Null otherwise.",
            "enum": [
              "violence",
              "sexual",
              "self_harm",
              null
            ]
          },
          "explanation_if_violating": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explanation of why the content is violating"
          }
        },
        "required": [
          "is_violating",
          "category",
          "explanation_if_violating"
        ],
        "additionalProperties": false
      },
      "strict": true
    }
  },
  "reasoning_effort": "low"
}'
async function main() {
  const headers = {
  "Authorization": "Bearer " + process.env.tokenba_API_KEY,
  "Content-Type": "application/json"
};
  const body = JSON.stringify({
  "model": "gpt-6.1-sol",
  "messages": [
    {
      "role": "system",
      "content": "Determine if the user input violates specific guidelines and explain if they do."
    },
    {
      "role": "user",
      "content": "How do I prepare for a job interview?"
    }
  ],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "content_compliance",
      "description": "Determines if content is violating specific moderation rules",
      "schema": {
        "type": "object",
        "properties": {
          "is_violating": {
            "type": "boolean",
            "description": "Indicates if the content is violating guidelines"
          },
          "category": {
            "type": [
              "string",
              "null"
            ],
            "description": "Type of violation, if the content is violating guidelines. Null otherwise.",
            "enum": [
              "violence",
              "sexual",
              "self_harm",
              null
            ]
          },
          "explanation_if_violating": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explanation of why the content is violating"
          }
        },
        "required": [
          "is_violating",
          "category",
          "explanation_if_violating"
        ],
        "additionalProperties": false
      },
      "strict": true
    }
  },
  "reasoning_effort": "low"
});
  const response = await fetch("https://api.apizt.com/v1/chat/completions", { method: "POST", headers, body });
  if (!response.ok) throw new Error("HTTP " + response.status + ": " + await response.text());
  console.log(await response.text());
}
main().catch(console.error);
import os
import requests

headers = {"Authorization": "Bearer " + os.environ["tokenba_API_KEY"]}
payload = {'model': 'gpt-6.1-sol',
 'messages': [{'role': 'system',
               'content': 'Determine if the user input violates specific guidelines '
                          'and explain if they do.'},
              {'role': 'user', 'content': 'How do I prepare for a job interview?'}],
 'response_format': {'type': 'json_schema',
                     'json_schema': {'name': 'content_compliance',
                                     'description': 'Determines if content is '
                                                    'violating specific moderation '
                                                    'rules',
                                     'schema': {'type': 'object',
                                                'properties': {'is_violating': {'type': 'boolean',
                                                                                'description': 'Indicates '
                                                                                               'if '
                                                                                               'the '
                                                                                               'content '
                                                                                               'is '
                                                                                               'violating '
                                                                                               'guidelines'},
                                                               'category': {'type': ['string',
                                                                                     'null'],
                                                                            'description': 'Type '
                                                                                           'of '
                                                                                           'violation, '
                                                                                           'if '
                                                                                           'the '
                                                                                           'content '
                                                                                           'is '
                                                                                           'violating '
                                                                                           'guidelines. '
                                                                                           'Null '
                                                                                           'otherwise.',
                                                                            'enum': ['violence',
                                                                                     'sexual',
                                                                                     'self_harm',
                                                                                     None]},
                                                               'explanation_if_violating': {'type': ['string',
                                                                                                     'null'],
                                                                                            'description': 'Explanation '
                                                                                                           'of '
                                                                                                           'why '
                                                                                                           'the '
                                                                                                           'content '
                                                                                                           'is '
                                                                                                           'violating'}},
                                                'required': ['is_violating',
                                                             'category',
                                                             'explanation_if_violating'],
                                                'additionalProperties': False},
                                     'strict': True}},
 'reasoning_effort': 'low'}
response = requests.post('https://api.apizt.com/v1/chat/completions', headers=headers, json=payload, timeout=120)
response.raise_for_status()
print(response.text)

返回响应

Chat Completions 文本位于 choices[].message.content。以下为结构示例,不代表实际调用结果。

{
  "id": "chatcmpl_demo",
  "object": "chat.completion",
  "model": "gpt-6.1-sol",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "{\"is_violating\": false, \"category\": null, \"explanation_if_violating\": null}"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 8,
    "total_tokens": 18
  }
}

示例先设置 tokenba_API_KEY。JavaScript 使用 Node.js 20+,Python 安装 requests。流式示例的 Python 与 JavaScript 会逐段输出事件数据。代码中的 ID、文件名与令牌须替换为自己的值。

GPT-6.1 Sol 的 Chat 请求使用 reasoning_effort,Responses 使用 reasoning.effort;等级为 low、medium、high、xhigh、max。工具调用使用 Responses。官方型号说明。

当前模型与版本

依据 apizt 价格页,同步于 。以下型号按目录声明的协议与本页用途筛选;不代表所有参数和功能通用。切换前请核对型号说明、令牌分组与参数差异。Gemini 原生接口需同时替换 URL 中的模型 ID。

模型 ID能力标签支持分组
gpt-6.1-sol对话,工具,识图,思考
分组(9)

Azure-Gpt-2、Azure-Gpt-3、Azure-Gpt-4、Azure-Gpt-5、Codex-Gpt-1、Codex-Gpt-2、Codex-Gpt-3、Openai-Gpt-1、Openai-Gpt-2

gpt-6-astra对话,工具,识图,思考
分组(10)

Azure-Gpt-2、Azure-Gpt-3、Azure-Gpt-4、Azure-Gpt-5、Azure-Gpt-6、Codex-Gpt-1、Codex-Gpt-2、Codex-Gpt-3、Openai-Gpt-1、Openai-Gpt-2

gpt-6-sol对话,工具,识图,思考
分组(10)

Azure-Gpt-2、Azure-Gpt-3、Azure-Gpt-4、Azure-Gpt-5、Azure-Gpt-6、Codex-Gpt-1、Codex-Gpt-2、Codex-Gpt-3、Openai-Gpt-1、Openai-Gpt-2

gpt-6-luna对话,工具,识图,思考
分组(10)

Azure-Gpt-2、Azure-Gpt-3、Azure-Gpt-4、Azure-Gpt-5、Azure-Gpt-6、Codex-Gpt-1、Codex-Gpt-2、Codex-Gpt-3、Openai-Gpt-1、Openai-Gpt-2

claude-sonnet-5-5对话,识图,工具
分组(6)

AWS-Bedrock-2、AWS-Claude-2、AWS-Claude-3、Claude-Code-1、Claude-Code-2、Kiro-Claude-1

claude-opus-5-5对话,工具,识图
分组(6)

AWS-Bedrock-2、AWS-Claude-2、AWS-Claude-3、Claude-Code-1、Claude-Code-2、Kiro-Claude-1

claude-sonnet-5对话,识图,工具
分组(8)

AWS-Bedrock-2、AWS-Claude-2、AWS-Claude-3、Anthropic-Claude-1、Claude-Code-1、Claude-Code-2、Kiro-Claude-1、Vertex-Claude-1

claude-fable-5-1对话,识图,工具
分组(5)

AWS-Claude-2、AWS-Claude-3、Anthropic-Claude-1、Claude-Code-1、Claude-Code-2

共列入 220 个候选型号。查看完整模型、版本与接口目录。