MCPcopy Create free account
hub / github.com/BerriAI/litellm / github_host_endpoints

Function github_host_endpoints

litellm/llms/github_copilot/github_host.py:47–78  ·  view source on GitHub ↗
(host: str)

Source from the content-addressed store, hash-verified

45
46
47def github_host_endpoints(host: str) -> GithubHostEndpoints:
48 normalized: Final = normalized_github_host(host)
49 if normalized is None:
50 raise ValueError("host must be github.com or a single-subdomain GHE.com hostname")
51 client_id: Final = os.getenv("GITHUB_COPILOT_CLIENT_ID", DEFAULT_GITHUB_CLIENT_ID)
52 if normalized == GITHUB_COPILOT_DEFAULT_HOST:
53 return GithubHostEndpoints(
54 host=normalized,
55 device_code_url=os.getenv("GITHUB_COPILOT_DEVICE_CODE_URL", DEFAULT_GITHUB_DEVICE_CODE_URL),
56 access_token_url=os.getenv("GITHUB_COPILOT_ACCESS_TOKEN_URL", DEFAULT_GITHUB_ACCESS_TOKEN_URL),
57 copilot_user_url=DEFAULT_GITHUB_COPILOT_USER_URL,
58 user_url="https://api.github.com/user",
59 client_id=client_id,
60 copilot_api_hosts=frozenset({"githubcopilot.com"}),
61 copilot_api_host_suffix=".githubcopilot.com",
62 default_copilot_api_base="https://api.githubcopilot.com",
63 )
64
65 subdomain: Final = normalized.removesuffix(".ghe.com")
66 api_host: Final = f"api.{subdomain}.ghe.com"
67 copilot_api_host: Final = f"copilot-api.{subdomain}.ghe.com"
68 return GithubHostEndpoints(
69 host=normalized,
70 device_code_url=f"https://{normalized}/login/device/code",
71 access_token_url=f"https://{normalized}/login/oauth/access_token",
72 copilot_user_url=f"https://{api_host}/copilot_internal/user",
73 user_url=f"https://{api_host}/user",
74 client_id=client_id,
75 copilot_api_hosts=frozenset({copilot_api_host}),
76 copilot_api_host_suffix=None,
77 default_copilot_api_base=f"https://{copilot_api_host}",
78 )

Calls 2

normalized_github_hostFunction · 0.85
GithubHostEndpointsClass · 0.85