33
44"""AI API endpoint and token management.
55
6- Supports multiple API providers (GitHub Copilot, GitHub Models, OpenAI, and
6+ Supports multiple API providers (GitHub Copilot, OpenAI, and
77custom endpoints). All provider-specific behaviour is captured in a single
88``APIProvider`` dataclass so that adding a new provider only requires one
99registry entry instead of changes scattered across multiple match/case blocks.
@@ -91,19 +91,6 @@ def check_tool_calls(self, _model: str, model_info: dict) -> bool:
9191 )
9292
9393
94- class _GitHubModelsProvider (APIProvider ):
95- """GitHub Models API (models.github.ai)."""
96-
97- def parse_models_list (self , body : Any ) -> list [dict ]:
98- # Models API returns a bare list, not {"data": [...]}
99- if isinstance (body , list ):
100- return body
101- return super ().parse_models_list (body )
102-
103- def check_tool_calls (self , _model : str , model_info : dict ) -> bool :
104- return "tool-calling" in model_info .get ("capabilities" , [])
105-
106-
10794class _OpenAIProvider (APIProvider ):
10895 """OpenAI API (api.openai.com).
10996
@@ -127,12 +114,6 @@ def check_tool_calls(self, _model: str, model_info: dict) -> bool:
127114 default_model = "gpt-4.1" ,
128115 extra_headers = {"Copilot-Integration-Id" : COPILOT_INTEGRATION_ID },
129116 ),
130- "models.github.ai" : _GitHubModelsProvider (
131- name = "github-models" ,
132- base_url = "https://models.github.ai/inference" ,
133- models_catalog = "/catalog/models" ,
134- default_model = "openai/gpt-4.1" ,
135- ),
136117 "api.openai.com" : _OpenAIProvider (
137118 name = "openai" ,
138119 base_url = "https://api.openai.com/v1" ,
0 commit comments