跳到主要內容
AI News HubLIVE
來源內容 · 翻譯待補全5 分鐘閱讀

待翻譯:Accessing OpenAI GPT models on Amazon Bedrock with global cross-Region inference in Thailand, Malaysia, Singapore, Indonesia, and Taiwan

文章摘要

AI 服務暫時不可用,以下為來源摘要,待恢復後補全翻譯:Learn how to run OpenAI GPT-6 Sol, Luna, and Astra on Amazon Bedrock through global cross-Region inference from Singapore, Jakarta, Thailand, Malaysia, and Taipei. This post covers the Converse and OpenAI-compatible APIs, IAM and SCP permissions, quota sizing, and monitoring inference from your source Region.

來源AWS Machine Learning Blog作者: Traci Lim
待翻譯:Accessing OpenAI GPT models on Amazon Bedrock with global cross-Region inference in Thailand, Malaysia, Singapore, Indonesia, and Taiwan
回報錯誤

更正管道尚未開通,可先複製下方文章資訊留存。

查看更正說明
直接讀正文

AI 服務暫時不可用,以下為來源正文,待恢復後補全翻譯。

Single-Region inference can throttle when demand exceeds local capacity. Teams in Thailand, Malaysia, Singapore, Indonesia, and Taiwan need access to the newest OpenAI models beyond that capacity. Amazon Bedrock offers OpenAI GPT-6 Sol and GPT-6 Luna through global cross-Region inference from all five AWS Regions, and GPT-6 Astra from Asia Pacific (Singapore). This post shows you how to configure the call, set permissions, and monitor inference from your source Region. GPT-6 Sol, GPT-6 Luna, and GPT-6 Astra are all available through global cross-Region inference from the preceding Regions, on the bedrock-runtime endpoint. See Cross-Region inference in the Amazon Bedrock User Guide. For the full list of source and destination Regions in each profile, see Supported Regions and models for inference profiles. In this post, we introduce the global cross-Region inference profiles and invoke them from Asia Pacific (Singapore) using the Converse API, the OpenAI-compatible APIs, and coding clients. We then cover the AWS Identity and Access Management (IAM) and service control policy (SCP) configuration, quota management, and monitoring. Global cross-Region inference profiles for OpenAI GPT-6 The GPT-6 family offers three models, each available through global cross-Region inference. GPT-6 Sol brings strong reasoning and coding capabilities to complex tasks performed throughout the week. GPT-6 Luna makes focused, repeatable tasks practical at high volume. GPT-6 Astra handles complex reasoning, coding, and long-document work. All three accept text and image input, client-side tool use, and prompt caching. They differ on reasoning effort. GPT-6 Sol and GPT-6 Luna accept none, low, medium, high, xhigh, and max. GPT-6 Astra accepts the same levels except none. For GPT-6 Sol and GPT-6 Luna, see Bring more intelligence to everyday work with GPT-6 Sol and GPT-6 Luna on Amazon Bedrock. For GPT-6 Astra, see Take on your most ambitious work with GPT-6 Astra on Amazon Bedrock. Global cross-Region inference routes requests across supported commercial AWS Regions where the model is deployed, giving you broad access to Amazon Bedrock capacity. You invoke it by passing a global cross-Region inference profile ID in place of a model ID. Your source Region is where you make the API call. Amazon Bedrock selects the destination Region for processing. Billing, quota tracking, AWS CloudTrail, and Amazon CloudWatch all stay in your source Region. The following table lists the global cross-Region inference profile IDs and the source Regions covered in this post. Global cross-Region inference profiles Source Regions Destination Regions global.openai.gpt-6-sol global.openai.gpt-6-luna Asia Pacific (Singapore) ap-southeast-1 Asia Pacific (Jakarta) ap-southeast-3 Asia Pacific (Malaysia) ap-southeast-5 Asia Pacific (Thailand) ap-southeast-7 Asia Pacific (Taipei) ap-east-2 Supported commercial AWS Regions where the model is deployed global.openai.gpt-6-astra Asia Pacific (Singapore) ap-southeast-1 Supported commercial AWS Regions where the model is deployed Inference profile availability and Region support change as AWS adds Regions and profiles, so confirm both on the model card before you build: GPT-6 Sol, GPT-6 Luna, and GPT-6 Astra. For per-token rates, see Amazon Bedrock pricing. Getting started with OpenAI models on Amazon Bedrock Start with the prerequisites, then invoke any of the three profiles through the Converse API, the OpenAI-compatible APIs, or your existing coding client. Prerequisites An IAM identity with permission to invoke the profile. The IAM policy in the Security and permissions section grants only what these examples need. Your source Region activated. Only the Region you call from needs activating. You do not activate destination Regions, which run on Amazon Bedrock managed capacity. Singapore (ap-southeast-1) is a Region that is enabled by default. Jakarta (ap-southeast-3), Malaysia (ap-southeast-5), Thailand (ap-southeast-7), and Taipei (ap-east-2) are opt-in Regions you must activate first. For more information, see Enable or disable AWS Regions in your account. A current AWS SDK or CLI. The OpenAI-compatible examples also require the OpenAI SDK and the Amazon Bedrock token generator. Install them with pip install boto3 openai aws-bedrock-token-generator. The Amazon Bedrock console lists all three global cross-Region inference profiles under system-defined inference profiles. See Figure 1. Figure 1: The three global OpenAI GPT-6 inference profiles among the system-defined profiles in the Amazon Bedrock console Invoke GPT-6 models through Amazon Bedrock Runtime Each model supports three access paths on this endpoint: the Amazon Bedrock Converse API, the OpenAI Responses API, and the OpenAI Chat Completions API. The OpenAI-compatible APIs are called on the /openai/v1 paths rather than through the AWS SDKs, and the endpoint accepts either Signature Version 4 (SigV4) or an Amazon Bedrock API key. Pass the global cross-Region inference profile ID as the model in every case. Converse API. This example calls GPT-6 Sol from Asia Pacific (Singapore) and logs the response. Set BEDROCK_PROFILE_ID to global.openai.gpt-6-luna or global.openai.gpt-6-astra to switch models, or call converse_stream for streaming. import logging import os import boto3 # AWS_REGION overrides this default, so set it to your source Region or unset it. REGION = os.environ.get("AWS_REGION", "ap-southeast-1") PROFILE_ID = os.environ.get("BEDROCK_PROFILE_ID", "global.openai.gpt-6-sol") PROMPT = ( "In three bullet points, explain when a workload should use " "cross-Region inference instead of calling a model in a single Region." ) logging.basicConfig(format="%(levelname)s %(message)s") log = logging.getLogger("bedrock-cris") log.setLevel(logging.INFO) client = boto3.client("bedrock-runtime", region_name=REGION) # AccessDeniedException points at the IAM policy. ValidationException usually # means the model ID is not a global cross-Region inference profile. response = client.converse( modelId=PROFILE_ID, messages=[{"role": "user", "content": [{"text": PROMPT}]}], inferenceConfig={"maxTokens": 1024}, # GPT-6 Sol and Luna accept none through max. GPT-6 Astra rejects none. additionalModelRequestFields={"reasoning": {"effort": "low"}}, ) # Any effort above none can prepend a reasoningContent block, so pick the text # block by key rather than by position. text = "".join(b["text"] for b in response["output"]["message"]["content"] if "text" in b) log.info("Called %s from %s", PROFILE_ID, REGION) log.info("Stop reason: %s", response["stopReason"]) log.info("Response:\n%s", text) OpenAI Chat Completions API. Point the OpenAI SDK at the Regional endpoint and pass the same profile ID. import logging import os from aws_bedrock_token_generator import provide_token from openai import OpenAI REGION = os.environ.get("AWS_REGION", "ap-southeast-1") PROFILE_ID = os.environ.get("BEDROCK_PROFILE_ID", "global.openai.gpt-6-sol") PROMPT = "List three uses for a message queue." logging.basicConfig(format="%(levelname)s %(message)s") log = logging.getLogger("bedrock-cris") log.setLevel(logging.INFO) # provide_token mints a short-term key from your AWS credentials, valid up to 12 hours. client = OpenAI( base_url=f"https://bedrock-runtime.{REGION}.amazonaws.com/openai/v1", api_key=provide_token(region=REGION), ) response = client.chat.completions.create( model=PROFILE_ID, messages=[{"role": "user", "content": PROMPT}], max_completion_tokens=256, ) log.info("Called %s from %s", PROFILE_ID, REGION) log.info("Response:\n%s", response.choices[0].message.content) When migrating an existing OpenAI client: Set the model parameter on every request, including those referencing a previous response. Use supported tool types: function, mcp, custom, namespace, and tool_search. Configure the inference profile ID directly in your client rather than querying the models endpoint. Set up the ChatGPT desktop app and Codex CLI The ChatGPT desktop app and the Codex CLI share ~/.codex/config.toml, so one change covers both. Of the two built-in Amazon Bedrock providers, only amazon-bedrock-runtime accepts an inference profile. model = "global.openai.gpt-6-astra" model_provider = "amazon-bedrock-runtime" [model_providers.amazon-bedrock-runtime.aws] region = "ap-southeast-1" SigV4 signing means there is no key to rotate. Add profile = "" for a non-default profile, and set region explicitly, because the client otherwise falls back to AWS_REGION. Substitute another profile ID for model to change models. Codex reports a 272,000-token window for these profiles, which is its own bundled figure rather than a service limit. Raise it with model_context_window. This configuration needs Codex CLI 0.148 or later. Figure 2 shows the result in the app. Figure 2: The ChatGPT desktop app running GPT-6 Astra on Amazon Bedrock Security and permissions Amazon Bedrock offers a range of controls over inference. Two of them matter here. AWS Identity and Access Management (IAM) policies control which roles can invoke which profiles, and service control policies (SCPs) apply organization-wide controls, including Region scope. This section covers both, and where request data lands. IAM permissions for global cross-Region inference To call any of these models through a global cross-Region inference profile, your IAM policy needs four statements: Access to the inference profile and the project/default resource in your source Region. Access to the foundation model in your source Region, scoped to the inference profile. The Region-agnostic Amazon Resource Name (ARN) for the foundation model, arn:aws:bedrock:::foundation-model/openai.gpt-6-sol, with aws:RequestedRegion set to unspecified to permit cross-Region routing. bedrock:CallWithBearerToken for API-key authentication. This IAM policy grants permission to invoke GPT-6 Sol through global cross-Region inference from ap-southeast-1. Replace with your AWS account ID and ap-southeast-1 with your source Region. { "Version": "2012-10-17", "Statement": [ { "Sid": "GrantGlobalCrisProfileAndProjectAccess", "Effect": "Allow", "Action": ["bedrock:InvokeModel"], "Resource": [ "arn:aws:bedrock:ap-southeast-1::inference-profile/global.openai.gpt-6-sol", "arn:aws:bedrock:ap-southeast-1::project/default" ], "Condition": { "StringEquals": { "aws:RequestedRegion": "ap-southeast-1" } } }, { "Sid": "GrantGlobalCrisInRegionModelAccess", "Effect": "Allow", "Action": ["bedrock:InvokeModel"], "Resource": ["arn:aws:bedrock:ap-southeast-1::foundation-model/openai.gpt-6-sol"], "Condition": { "StringEquals": { "aws:RequestedRegion": "ap-southeast-1", "bedrock:InferenceProfileArn": "arn:aws:bedrock:ap-southeast-1::inference-profile/global.openai.gpt-6-sol" } } }, { "Sid": "GrantGlobalCrisGlobalModelAccess", "Effect": "Allow", "Action": ["bedrock:InvokeModel"], "Resource": ["arn:aws:bedrock:::foundation-model/openai.gpt-6-sol"], "Condition": { "StringEquals": { "aws:RequestedRegion": "unspecified", "bedrock:InferenceProfileArn": "arn:aws:bedrock:ap-southeast-1::inference-profile/global.openai.gpt-6-sol" } } }, { "Sid": "AllowBearerTokenAuth", "Effect": "Allow", "Action": ["bedrock:CallWithBearerToken"], "Resource": "*" } ] } If you use streaming (converse_stream or stream=True), add bedrock:InvokeModelWithResponseStream to the Action in the first three statements. Converse authorizes as bedrock:InvokeModel. If you only call Converse with SigV4 credentials, drop the fourth statement. To switch models, replace openai.gpt-6-sol with openai.gpt-6-luna or openai.gpt-6-astra throughout. For the complete reference, see IAM policy requirements for global cross-Region inference. Service control policy considerations for global cross-Region inference A global cross-Region inference request carries no Region name. Amazon Bedrock sets aws:RequestedRegion to unspecified, so a Region allowlis [truncated for AI cost control]

展開要點與分析

文章情報

工程師進階

要點

  • AI 服務暫時不可用,系統已先保留來源內容與降級後設資料。
  • Learn how to run OpenAI GPT-6 Sol, Luna, and Astra on Amazon Bedrock through global cross-Region inference from Singapore, Jakarta, Thailand, Malaysia, and Taipei. This post cover…

要點與分析由自動化流程生成,可能有誤,請結合原始來源核實。