MCPcopy Create free account
hub / github.com/OpenRouterTeam/python-sdk / update_async

Method update_async

src/openrouter/byok.py:1361–1523  ·  view source on GitHub ↗

r"""Update a BYOK provider credential Update an existing bring-your-own-key (BYOK) provider credential by its `id`. Include the `key` field to rotate the raw provider API key in-place (the previous key material is overwritten). [Management key](/docs/guides/overview/auth/management-api-keys

(
        self,
        *,
        id: str,
        http_referer: Optional[str] = None,
        x_open_router_title: Optional[str] = None,
        x_open_router_categories: Optional[str] = None,
        allowed_models: OptionalNullable[Iterable[str]] = UNSET,
        allowed_user_ids: OptionalNullable[Iterable[str]] = UNSET,
        disabled: Optional[bool] = None,
        is_fallback: Optional[bool] = None,
        key: Optional[str] = None,
        name: OptionalNullable[str] = UNSET,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    )

Source from the content-addressed store, hash-verified

1359 raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
1360
1361 async def update_async(
1362 self,
1363 *,
1364 id: str,
1365 http_referer: Optional[str] = None,
1366 x_open_router_title: Optional[str] = None,
1367 x_open_router_categories: Optional[str] = None,
1368 allowed_models: OptionalNullable[Iterable[str]] = UNSET,
1369 allowed_user_ids: OptionalNullable[Iterable[str]] = UNSET,
1370 disabled: Optional[bool] = None,
1371 is_fallback: Optional[bool] = None,
1372 key: Optional[str] = None,
1373 name: OptionalNullable[str] = UNSET,
1374 retries: OptionalNullable[utils.RetryConfig] = UNSET,
1375 server_url: Optional[str] = None,
1376 timeout_ms: Optional[int] = None,
1377 http_headers: Optional[Mapping[str, str]] = None,
1378 ) -> components.UpdateBYOKKeyResponse:
1379 r"""Update a BYOK provider credential
1380
1381 Update an existing bring-your-own-key (BYOK) provider credential by its `id`. Include the `key` field to rotate the raw provider API key in-place (the previous key material is overwritten). [Management key](/docs/guides/overview/auth/management-api-keys) required.
1382
1383 :param id: The BYOK credential ID (UUID).
1384 :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
1385 This is used to track API usage per application.
1386
1387 :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
1388
1389 :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
1390
1391 :param allowed_models: Optional allowlist of model slugs this credential may be used for. `null` means no restriction.
1392 :param allowed_user_ids: Optional allowlist of user IDs that may use this credential. `null` means no restriction.
1393 :param disabled: Whether this credential is disabled.
1394 :param is_fallback: Whether this credential is treated as a fallback — used only after non-fallback keys for the same provider have been tried.
1395 :param key: A new raw provider API key to rotate the credential in-place. The previous key material is overwritten and the masked label is regenerated. Encrypted at rest and never returned in API responses.
1396 :param name: Optional human-readable name for the credential.
1397 :param retries: Override the default retry configuration for this method
1398 :param server_url: Override the default server URL for this method
1399 :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1400 :param http_headers: Additional headers to set or replace on requests.
1401 """
1402 base_url = None
1403 url_variables = None
1404 if timeout_ms is None:
1405 timeout_ms = self.sdk_configuration.timeout_ms
1406
1407 if server_url is not None:
1408 base_url = server_url
1409 else:
1410 base_url = self._get_url(base_url, url_variables)
1411
1412 request = operations.UpdateBYOKKeyRequest(
1413 http_referer=http_referer,
1414 x_open_router_title=x_open_router_title,
1415 x_open_router_categories=x_open_router_categories,
1416 id=id,
1417 update_byok_key_request=components.UpdateBYOKKeyRequest(
1418 allowed_models=utils.unmarshal(

Callers

nothing calls this directly

Calls 6

HookContextClass · 0.90
get_security_from_envFunction · 0.90
unmarshal_json_responseFunction · 0.90
_get_urlMethod · 0.80
_build_request_asyncMethod · 0.80
do_request_asyncMethod · 0.80

Tested by

no test coverage detected