{"record":{"id":"af67e060a2b3cbdf","repo":"openai/openai-python","slug":"asyncbedrockopenai-only-supports-bedrock-bearer-to","errorCode":null,"errorMessage":"AsyncBedrockOpenAI only supports Bedrock bearer token or AWS credential authentication.","messagePattern":"AsyncBedrockOpenAI only supports Bedrock bearer token or AWS credential authentication\\.","errorType":"exception","errorClass":"OpenAIError","httpStatus":null,"severity":"error","filePath":"src/openai/lib/bedrock.py","lineNumber":811,"sourceCode":"        timeout: float | Timeout | None | NotGiven = NOT_GIVEN,\n        http_client: httpx2.AsyncClient | None = None,\n        max_retries: int | NotGiven = NOT_GIVEN,\n        default_headers: Mapping[str, str] | None = None,\n        set_default_headers: Mapping[str, str] | None = None,\n        default_query: Mapping[str, object] | None = None,\n        set_default_query: Mapping[str, object] | None = None,\n        _enforce_credentials: bool | None = None,\n        _extra_kwargs: Mapping[str, Any] = {},\n    ) -> Self:\n        if data_residency is not None:\n            raise OpenAIError(\"`data_residency` is only supported by OpenAI clients\")\n        base_url = None if isinstance(base_url, NotGiven) else base_url\n        if callable(api_key):\n            raise OpenAIError(\"Pass refreshable Bedrock credentials via `bedrock_token_provider`, not `api_key`.\")\n        if not isinstance(provider, NotGiven):\n            raise OpenAIError(\"Configure `provider` on `AsyncOpenAI`, not on `AsyncBedrockOpenAI.with_options()`.\")\n        if admin_api_key is not None or workload_identity is not None:\n            raise OpenAIError(\"AsyncBedrockOpenAI only supports Bedrock bearer token or AWS credential authentication.\")\n        if default_headers is not None and set_default_headers is not None:\n            raise ValueError(\"The `default_headers` and `set_default_headers` arguments are mutually exclusive\")\n        if default_query is not None and set_default_query is not None:\n            raise ValueError(\"The `default_query` and `set_default_query` arguments are mutually exclusive\")\n\n        headers = self._custom_headers\n        if default_headers is not None:\n            headers = {**headers, **default_headers}\n        elif set_default_headers is not None:\n            headers = set_default_headers\n        params = self._custom_query\n        if default_query is not None:\n            params = {**params, **default_query}\n        elif set_default_query is not None:\n            params = set_default_query\n\n        provider_kwargs, inherited_provider, inherited_state = _copy_configuration(\n            self,","sourceCodeStart":793,"sourceCodeEnd":829,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/lib/bedrock.py#L793-L829","documentation":"The async Bedrock client's `copy()` rejects `admin_api_key` and `workload_identity`. AsyncBedrockOpenAI supports only Bedrock bearer tokens or AWS credentials; platform-admin and workload-identity auth are first-party OpenAI features.","triggerScenarios":"`async_bedrock_client.with_options(admin_api_key='...')` or `with_options(workload_identity=...)` — either non-None.","commonSituations":"Shared async config objects applied across client types; migrating platform automation to a Bedrock endpoint.","solutions":["Remove these arguments from Bedrock calls","Use `AsyncOpenAI(admin_api_key=...)` for admin operations","Authenticate Bedrock with `api_key`, `bedrock_token_provider`, or `aws_*` credentials"],"exampleFix":"# before\nadmin = async_bedrock_client.with_options(admin_api_key=ADMIN_KEY)\n# after\nfrom openai import AsyncOpenAI\nadmin = AsyncOpenAI(admin_api_key=ADMIN_KEY)","handlingStrategy":"validation","validationCode":"for k in ('admin_api_key','workload_identity'):\n    assert kwargs.get(k) is None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use AsyncOpenAI for admin/workload-identity auth"],"tags":["bedrock","with-options","admin-key","async","unsupported-parameter"],"backgroundTag":"unsupported-parameter-for-client","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}