{"record":{"id":"d0f18d32d59f3023","repo":"microsoft/autogen","slug":"model-is-required-for-when-using-a-github-model-wi","errorCode":null,"errorMessage":"model is required for when using a Github model with AzureAIChatCompletionClient","messagePattern":"model is required for when using a Github model with AzureAIChatCompletionClient","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py","lineNumber":309,"sourceCode":"        config = self._validate_config(kwargs)  # type: ignore\n        self._model_info = config[\"model_info\"]  # type: ignore\n        self._client = self._create_client(config)\n        self._create_args = self._prepare_create_args(config)\n\n        self._actual_usage = RequestUsage(prompt_tokens=0, completion_tokens=0)\n        self._total_usage = RequestUsage(prompt_tokens=0, completion_tokens=0)\n\n    @staticmethod\n    def _validate_config(config: Dict[str, Any]) -> AzureAIChatCompletionClientConfig:\n        if \"endpoint\" not in config:\n            raise ValueError(\"endpoint is required for AzureAIChatCompletionClient\")\n        if \"credential\" not in config:\n            raise ValueError(\"credential is required for AzureAIChatCompletionClient\")\n        if \"model_info\" not in config:\n            raise ValueError(\"model_info is required for AzureAIChatCompletionClient\")\n        validate_model_info(config[\"model_info\"])\n        if _is_github_model(config[\"endpoint\"]) and \"model\" not in config:\n            raise ValueError(\"model is required for when using a Github model with AzureAIChatCompletionClient\")\n        return cast(AzureAIChatCompletionClientConfig, config)\n\n    @staticmethod\n    def _create_client(config: AzureAIChatCompletionClientConfig) -> ChatCompletionsClient:\n        # Only pass the parameters that ChatCompletionsClient accepts\n        # Remove 'model_info' and other client-specific parameters\n        client_config = {k: v for k, v in config.items() if k not in (\"model_info\",)}\n        return ChatCompletionsClient(**client_config)  # type: ignore\n\n    @staticmethod\n    def _prepare_create_args(config: Mapping[str, Any]) -> Dict[str, Any]:\n        create_args = {k: v for k, v in config.items() if k in create_kwargs}\n        return create_args\n\n    def add_usage(self, usage: RequestUsage) -> None:\n        self._total_usage = RequestUsage(\n            self._total_usage.prompt_tokens + usage.prompt_tokens,\n            self._total_usage.completion_tokens + usage.completion_tokens,","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/models/azure/_azure_ai_client.py#L291-L327","documentation":"Raised by AzureAIChatCompletionClient._validate_config when _is_github_model(config['endpoint']) is true (endpoint points at GitHub Models, e.g. https://models.github.ai/inference/) but no 'model' kwarg was given. GitHub Models hosts many models behind one endpoint, so the model id must be named explicitly.","triggerScenarios":"AzureAIChatCompletionClient(endpoint='https://models.github.ai/inference', credential=..., model_info=...) with model omitted.","commonSituations":"Using a GitHub personal access token against the Models inference endpoint and copying an Azure Foundry config that did not need 'model'; forgetting that model is only optional for non-GitHub endpoints.","solutions":["Add the model kwarg, e.g. model='openai/gpt-4o' (org/model format used by GitHub Models)","Alternatively point endpoint at an Azure AI Foundry deployment URL where the model is bound to the route","Double-check the endpoint string: anything matching the GitHub Models host triggers this requirement even if unintended"],"exampleFix":"# before\nclient = AzureAIChatCompletionClient(\n    endpoint=\"https://models.github.ai/inference\", credential=cred, model_info=info)\n\n# after\nclient = AzureAIChatCompletionClient(\n    endpoint=\"https://models.github.ai/inference\", credential=cred,\n    model=\"openai/gpt-4o\", model_info=info,\n)","handlingStrategy":"validation","validationCode":"def github_needs_model(endpoint: str, cfg: dict) -> bool:\n    return \"models.github.ai\" in endpoint and \"model\" not in cfg","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass model when the endpoint host is models.github.ai","Use org/model ids (e.g. 'openai/gpt-4o') for GitHub Models","Add a config lint rule keyed on the endpoint URL"],"tags":["azure","github-models","configuration","constructor"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}