{"record":{"id":"24e93a5f3b81879b","repo":"openai/openai-python","slug":"configure-provider-on-openai-not-on-bedrocko","errorCode":null,"errorMessage":"Configure `provider` on `OpenAI`, not on `BedrockOpenAI.with_options()`.","messagePattern":"Configure `provider` on `OpenAI`, not on `BedrockOpenAI\\.with_options\\(\\)`\\.","errorType":"exception","errorClass":"OpenAIError","httpStatus":null,"severity":"error","filePath":"src/openai/lib/bedrock.py","lineNumber":571,"sourceCode":"        base_url: str | httpx2.URL | None | NotGiven = NOT_GIVEN,\n        data_residency: DataResidency | None = None,\n        timeout: float | Timeout | None | NotGiven = NOT_GIVEN,\n        http_client: httpx2.Client | 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 `OpenAI`, not on `BedrockOpenAI.with_options()`.\")\n        if admin_api_key is not None or workload_identity is not None:\n            raise OpenAIError(\"BedrockOpenAI 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","sourceCodeStart":553,"sourceCodeEnd":589,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/lib/bedrock.py#L553-L589","documentation":"`BedrockOpenAI.with_options()` does not accept the `provider` argument; authentication providers are chosen implicitly by which credentials you pass. `provider` is an `OpenAI`-client concept (e.g. for Azure-style provider selection).","triggerScenarios":"`bedrock_client.with_options(provider='bedrock')` on the sync client — any non-NotGiven value for `provider` in copy.","commonSituations":"Generic wrapper code that forwards `provider` to every client; configuration intended for `OpenAI` accidentally applied to the Bedrock client.","solutions":["Remove `provider` from Bedrock `with_options` calls; auth mode is derived from api_key/aws_* arguments","Set `provider` only on the `OpenAI` client"],"exampleFix":"# before\nc = bedrock_client.with_options(provider='bedrock')\n# after\nc = bedrock_client.with_options(aws_profile='prod')","handlingStrategy":"validation","validationCode":"kwargs.pop('provider', None)  # before bedrock with_options","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set provider on OpenAI clients"],"tags":["bedrock","with-options","unsupported-parameter","provider"],"backgroundTag":"unsupported-parameter-for-client","analyzedSha":"9917c6e28e66e90e1227b3d223c06a8c5441515a","analyzedAt":"2026-08-28T11:46:34.183Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}