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

Method get

src/openrouter/byok.py:941–1067  ·  view source on GitHub ↗

r"""Get a BYOK provider credential Get a single bring-your-own-key (BYOK) provider credential by its `id`. [Management key](/docs/guides/overview/auth/management-api-keys) required. :param id: The BYOK credential ID (UUID). :param http_referer: The app identifier should be

(
        self,
        *,
        id: str,
        http_referer: Optional[str] = None,
        x_open_router_title: Optional[str] = None,
        x_open_router_categories: Optional[str] = None,
        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

939 raise errors.OpenRouterDefaultError("Unexpected response received", http_res)
940
941 def get(
942 self,
943 *,
944 id: str,
945 http_referer: Optional[str] = None,
946 x_open_router_title: Optional[str] = None,
947 x_open_router_categories: Optional[str] = None,
948 retries: OptionalNullable[utils.RetryConfig] = UNSET,
949 server_url: Optional[str] = None,
950 timeout_ms: Optional[int] = None,
951 http_headers: Optional[Mapping[str, str]] = None,
952 ) -> components.GetBYOKKeyResponse:
953 r"""Get a BYOK provider credential
954
955 Get a single bring-your-own-key (BYOK) provider credential by its `id`. [Management key](/docs/guides/overview/auth/management-api-keys) required.
956
957 :param id: The BYOK credential ID (UUID).
958 :param http_referer: The app identifier should be your app's URL and is used as the primary identifier for rankings.
959 This is used to track API usage per application.
960
961 :param x_open_router_title: The app display name allows you to customize how your app appears in OpenRouter's dashboard.
962
963 :param x_open_router_categories: Comma-separated list of app categories (e.g. \"cli-agent,cloud-agent\"). Used for marketplace rankings.
964
965 :param retries: Override the default retry configuration for this method
966 :param server_url: Override the default server URL for this method
967 :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
968 :param http_headers: Additional headers to set or replace on requests.
969 """
970 base_url = None
971 url_variables = None
972 if timeout_ms is None:
973 timeout_ms = self.sdk_configuration.timeout_ms
974
975 if server_url is not None:
976 base_url = server_url
977 else:
978 base_url = self._get_url(base_url, url_variables)
979
980 request = operations.GetBYOKKeyRequest(
981 http_referer=http_referer,
982 x_open_router_title=x_open_router_title,
983 x_open_router_categories=x_open_router_categories,
984 id=id,
985 )
986
987 req = self._build_request(
988 method="GET",
989 path="/byok/{id}",
990 base_url=base_url,
991 url_variables=url_variables,
992 request=request,
993 request_body_required=False,
994 request_has_path_params=True,
995 request_has_query_params=True,
996 user_agent_header="user-agent",
997 accept_header_value="application/json",
998 http_headers=http_headers,

Callers 15

serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45
serialize_modelMethod · 0.45

Calls 6

HookContextClass · 0.90
get_security_from_envFunction · 0.90
unmarshal_json_responseFunction · 0.90
_get_urlMethod · 0.80
_build_requestMethod · 0.80
do_requestMethod · 0.80

Tested by

no test coverage detected