{"record":{"id":"ed2314a90923f0d3","repo":"openai/openai-python","slug":"data-residency-is-only-supported-by-openai-clien-ed2314","errorCode":null,"errorMessage":"`data_residency` is only supported by OpenAI clients","messagePattern":"`data_residency` is only supported by OpenAI clients","errorType":"exception","errorClass":"OpenAIError","httpStatus":null,"severity":"error","filePath":"src/openai/lib/bedrock.py","lineNumber":566,"sourceCode":"        aws_credentials_provider: AwsCredentialsProvider | None = None,\n        organization: str | None = None,\n        project: str | None = None,\n        webhook_secret: str | None = None,\n        websocket_base_url: str | httpx2.URL | None = None,\n        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","sourceCodeStart":548,"sourceCodeEnd":584,"githubUrl":"https://github.com/openai/openai-python/blob/9917c6e28e66e90e1227b3d223c06a8c5441515a/src/openai/lib/bedrock.py#L548-L584","documentation":"`BedrockOpenAI.with_options()`/`copy()` rejects the `data_residency` parameter. Data residency routing is a first-party OpenAI API feature configured on `OpenAI` clients, not on Bedrock clients.","triggerScenarios":"`bedrock_client.with_options(data_residency='eu')` or `BedrockOpenAI(..., data_residency=...)` via copy on the sync client.","commonSituations":"Shared helper functions that call `with_options(**kwargs)` for both OpenAI and Bedrock clients; migrating EU-residency setup code from `OpenAI` to a Bedrock deployment.","solutions":["Remove `data_residency` from Bedrock client calls; residency for Bedrock is governed by the AWS region","Construct a separate `OpenAI(..., data_residency='eu')` client if you need first-party data residency"],"exampleFix":"# before\neu = bedrock_client.with_options(data_residency='eu')\n# after\neu = bedrock_client  # Bedrock residency follows the aws_region you configure","handlingStrategy":"validation","validationCode":"kwargs.pop('data_residency', None)  # before calling bedrock with_options","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep OpenAI-only options out of shared with_options wrappers","Branch client factories by client type"],"tags":["bedrock","data-residency","with-options","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"}