View a markdown version of this page

gpt-oss-20b - Amazon Bedrock

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

gpt-oss-20b

图标显示圆形图案,曲线段交织在一起,形成风车设计。 OpenAI — gpt-oss-20b

模型详细信息

GPT OSS 20B 是 OpenAI 的 200 亿个参数开源模型,用于以较低的计算成本高效生成和编码文本。有关模型开发和性能的更多信息,请参阅model/service 卡片。

输入模式 输出模式
Red circle with white X icon indicating error, cancel, or close action.音频Red circle with white X icon indicating error, cancel, or close action.嵌入
Red circle with white X icon indicating error, cancel, or close action.图片Red circle with white X icon indicating error, cancel, or close action.图片
Red circle with white X icon indicating error, cancel, or close action.演讲Red circle with white X icon indicating error, cancel, or close action.演讲
Green circle with white checkmark icon.文本Green circle with white checkmark icon.文本
Red circle with white X icon indicating error, cancel, or close action.视频Red circle with white X icon indicating error, cancel, or close action.视频

支持的终端节点和 API

下表显示了 gpt-oss-20b 支持哪些端点和 API。有关更多信息,请参阅亚马逊 Bedrock 支持的 API和亚马逊 Bedrock 支持的终端节点。

终端支持

Endpoint 支持的
bedrock-runtime supported
bedrock-mantle supported

bedrock-runtime终端支持的 API

消息 响应 聊天完成次数 Converse Invoke
not-supported supported supported supported supported

bedrock-mantle终端支持的 API

消息 响应 聊天完成次数 Converse Invoke
not-supported supported supported not-supported not-supported
注意

开启bedrock-mantle,两个 API 都使用/v1基本路径,而不是/openai/v1。在此模型中使用任一 API:

  • 对于响应,请使用/v1/responses。

  • 要完成聊天,请使用/v1/chat/completions。

提示

只要有可能,我们建议将bedrock-runtime终端节点用于新应用程序。有关详细信息,请参阅亚马逊 Bedrock 支持的终端节点。

能力和特点

基岩特征

使用bedrock-mantle终端节点支持的功能

使用bedrock-runtime终端节点支持的功能

定价

有关定价信息,请参阅亚马逊基岩定价页面。

以编程方式访问

使用以下模型 ID 和端点 URL 以编程方式访问此模型。有关可用 API 和终端节点的更多信息,请参阅支持的 API 和支持的终端节点。

Endpoint 模特 ID In-Region 端点 URL 地理推断 ID 全局推理 ID
bedrock-runtime openai.gpt-oss-20b-1:0 https://bedrock-runtime.{region}.amazonaws.com us-gov.openai.gpt-oss-20b-1:0 不支持
bedrock-mantle openai.gpt-oss-20b https://bedrock-mantle.{region}.api.aws/v1 不支持 不支持

例如,如果区域为 us-east-1(弗吉尼亚北部),则基岩运行时终端节点 URL 将为 “”,基岩地堡的网址将为 https://bedrock-runtime.us-east-1.amazonaws.com “”。https://bedrock-mantle.us-east-1.api.aws/v1

服务等级

Amazon Bedrock 提供多个服务等级以满足您的工作负载要求。Standard 提供按代币付费的访问权限,无需承诺(设置"service_tier": "default"或省略该字段)。Priority 以溢价(套装"service_tier": "priority")提供最快的响应时间。Flex 为灵活、非时间敏感的工作负载(套装)提供更低成本的访问权限。"service_tier": "flex"预留为可预测的工作负载提供专用吞吐量和期限承诺;它是在账户级别设置的,而不是根据每个请求设置的(请联系您的 AWS 账户团队来启用)。有关更多信息,请参阅服务等级。

Standard 优先级 Flex 已保留
Green circle with white checkmark icon. Green circle with white checkmark icon. Green circle with white checkmark icon. Red circle with white X icon indicating error, cancel, or close action.

区域可用性

区域可用性一览

Amazon Bedrock 提供三种推理选项:将请求In-Region保留在单一区域内以确保严格合规;在尊重数据驻留的前提下跨地理区域(例如美国、欧盟和亚太地区)进行地理路由;在没有居住限制的情况下,全球 Cross-Region路由到全球任何地方。 Cross-Region 有关更多详细信息,请参阅该按型号划分的区域可用性页面。

区域 In-Region 地理 Global
us-east-1(弗吉尼亚北部)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
us-east-2(俄亥俄州)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
us-west-2(俄勒冈州)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
eu-central-1(法兰克福)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
eu-north-1(斯德哥尔摩)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
eu-south-1(米兰)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
eu-west-1(爱尔兰)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
eu-west-2(伦敦)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
ap-northeast-1(东京)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
ap-south-1(孟买)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
ap-southeast-2(悉尼)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
ap-southeast-3(雅加达)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
sa-east-1(圣保罗)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
ap-southeast-4(墨尔本)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.
us-gov-west-1 (GovCloud)Green circle with white checkmark icon.Red circle with white X icon indicating error, cancel, or close action.Red circle with white X icon indicating error, cancel, or close action.

Geo CRIS 推理细节

美国 GovCloud 危机

美国 GovCloud CRIS 推断 ID:us-gov.openai.gpt-oss-20b-1:0

来源区域 目的地区域
us-gov-west-1(西部)GovCloud us-gov-west-1(GovCloud 西部)、us-gov-east-1(东部)GovCloud
us-gov-east-1(东部)GovCloud us-gov-west-1(GovCloud 西部)、us-gov-east-1(东部)GovCloud

配额和限制

您的 AWS 账户有默认配额,以维持服务的性能并确保适当使用 Amazon Bedrock。分配给账户的默认配额可能会根据地区因素、付款历史记录、欺诈性使用、配额增加请求的 and/or 批准情况进行更新。有关更多信息,请参阅Amazon Bedrock 的配额文档并查看模型的限制。

示例代码

第 1 步- AWS 账户:如果您已经有 AWS 账户,请跳过此步骤。如果您是新手 AWS,请注册一个 A WS 账户。

第 2 步-API 密钥:前往亚马逊 Bedrock 控制台并生成长期 API 密钥。

第 3 步-获取 SDK:要使用此入门指南,必须已安装 Python。然后根据您使用的 API 安装相关软件。

对于回复或聊天完成,选择 OpenAI SDK 选项卡。对于 “调用” 或 “交谈”,选择 Boto3 选项卡。

OpenAI SDK
pip install boto3 openai
Boto3
pip install boto3

第 4 步-设置环境变量

将您的环境配置为使用 API 密钥进行身份验证。

选择您的 SDK 和终端节点的选项卡。

bedrock-mantle
OPENAI_API_KEY="<provide your Bedrock API key>" OPENAI_BASE_URL="https://bedrock-mantle.<your-region>.api.aws/v1"
bedrock-runtime
OPENAI_API_KEY="<provide your Bedrock API key>" OPENAI_BASE_URL="https://bedrock-runtime.<your-region>.amazonaws.com/openai/v1"
Boto3
AWS_BEARER_TOKEN_BEDROCK="<provide your Bedrock API key>"

第 5 步-运行您的第一个推理请求

将文件另存为 bedrock-first-request.py

基岩斗篷

使用步骤 4-设置环境变量中的设置。选择 bedrock-mantle 选项卡。聊天选项卡使用聊天完成 API。

Responses API
from openai import OpenAI client = OpenAI() response = client.responses.create( model="openai.gpt-oss-20b", input="Can you explain the features of Amazon Bedrock?" ) print(response)
Chat
from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="openai.gpt-oss-20b", messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}] ) print(response)

基石运行时:OpenAI SDK

使用步骤 4-设置环境变量中的设置。选择 bedrock-runtime 选项卡。聊天选项卡使用聊天完成 API。

Responses API
from openai import OpenAI client = OpenAI() response = client.responses.create( model="openai.gpt-oss-20b", input="Can you explain the features of Amazon Bedrock?" ) print(response)
Chat
from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="openai.gpt-oss-20b", messages=[{"role": "user", "content": "Can you explain the features of Amazon Bedrock?"}] ) print(response)

bedrock-runtime:Boto3

使用步骤 4-设置环境变量中的 Boto3 设置。为您的请求选择 API。

Invoke API
import json import boto3 client = boto3.client('bedrock-runtime', region_name='us-east-1') response = client.invoke_model( modelId='openai.gpt-oss-20b-1:0', body=json.dumps({ 'messages': [{ 'role': 'user', 'content': 'Can you explain the features of Amazon Bedrock?'}], 'max_tokens': 1024 }) ) print(json.loads(response['body'].read()))
Converse API
import boto3 client = boto3.client('bedrock-runtime', region_name='us-east-1') response = client.converse( modelId='openai.gpt-oss-20b-1:0', messages=[ { 'role': 'user', 'content': [{'text': 'Can you explain the features of Amazon Bedrock?'}] } ] ) print(response)