{"record":{"id":"c7d0c18e847760ee","repo":"mlflow/mlflow","slug":"the-completions-endpoint-is-not-supported-for-sel","errorCode":null,"errorMessage":"The completions endpoint is not supported for {self.config.model.name} on Vertex AI. Use the chat endpoint instead.","messagePattern":"The completions endpoint is not supported for (.+?) on Vertex AI\\. Use the chat endpoint instead\\.","errorType":"http","errorClass":"AIGatewayException","httpStatus":501,"severity":"error","filePath":"mlflow/gateway/providers/vertex_ai.py","lineNumber":297,"sourceCode":"            return self._delegate.get_endpoint_url(route_type)\n        return super().get_endpoint_url(route_type)\n\n    async def _chat(self, payload):\n        if self._delegate:\n            return await self._delegate._chat(payload)\n        return await super()._chat(payload)\n\n    async def _chat_stream(self, payload):\n        if self._delegate:\n            async for chunk in self._delegate._chat_stream(payload):\n                yield chunk\n            return\n        async for chunk in super()._chat_stream(payload):\n            yield chunk\n\n    async def _completions(self, payload):\n        if self._model_type in (\"claude\", \"maas\"):\n            raise AIGatewayException(\n                status_code=501,\n                detail=(\n                    f\"The completions endpoint is not supported for {self.config.model.name} on \"\n                    \"Vertex AI. Use the chat endpoint instead.\"\n                ),\n            )\n        return await super()._completions(payload)\n\n    async def _completions_stream(self, payload):\n        if self._model_type in (\"claude\", \"maas\"):\n            raise AIGatewayException(\n                status_code=501,\n                detail=(\n                    f\"The completions endpoint is not supported for {self.config.model.name} on \"\n                    \"Vertex AI. Use the chat endpoint instead.\"\n                ),\n            )\n        async for chunk in super()._completions_stream(payload):","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/gateway/providers/vertex_ai.py#L279-L315","documentation":"The Vertex AI provider deliberately rejects the completions endpoint for claude and maas model types, raising AIGatewayException with status 501 Not Implemented, because Vertex AI exposes those models only through the chat (rawPredict) API.","triggerScenarios":"Calling the gateway's /completions endpoint (route_type llm/v1/completions) on a route whose model is a Vertex AI Claude or MaaS model.","commonSituations":"Client code written for OpenAI-style completions being pointed at a Vertex Claude gateway route, or migrating routes from OpenAI to Vertex AI without updating callers.","solutions":["Call the gateway's /chat/completions endpoint instead of /completions.","Update client code to use the chat messages format.","Configure a separate provider (e.g. OpenAI or Anthropic direct) if a completions endpoint is required."],"exampleFix":"// before\nclient.completions.create(prompt=\"...\", model=\"vertex-claude-route\")\n// after\nclient.chat.completions.create(messages=[{\"role\": \"user\", \"content\": \"...\"}], model=\"vertex-claude-route\")","handlingStrategy":"try-catch","validationCode":"def assert_chat_only(model_type: str, endpoint: str):\n    if model_type in ('claude', 'maas') and endpoint == 'completions':\n        raise ValueError('Vertex AI claude/maas models support only the chat endpoint')","typeGuard":null,"tryCatchPattern":"try:\n    resp = await gateway_completions(route)\nexcept MlflowException as e:\n    if '501' in str(e) or 'not supported' in str(e):\n        log.error('Use the chat/completions endpoint for Vertex AI Claude models')\n        resp = await gateway_chat(route)","preventionTips":["Route all Claude-on-Vertex traffic through the chat endpoint.","Update OpenAI-style completions clients when migrating to Vertex Claude.","Document endpoint support per provider in your service layer."],"tags":["vertex-ai","claude","unsupported","gateway"],"backgroundTag":"endpoint-not-implemented","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}