How to Fix LiteLLM Model Routing When Using a Custom OpenAI-Compatible Proxy
A developer configuring OpenOPC, an AI agent framework, to use a cost-saving custom OpenAI-compatible proxy at freetheai.xyz encountered repeated routing errors from LiteLLM, the model-routing library OpenOPC uses internally. The first error arose because LiteLLM could not recognise the 'glm/' provider prefix without an explicit API format hint, which was resolved by prepending 'openai/' to the model name. However, the proxy then rejected the request because LiteLLM strips that prefix before forwarding, sending only 'glm-5.2' instead of the full model ID the proxy expected. Querying the proxy's '/v1/models' endpoint revealed the correct registered model string, and stacking the prefix as 'openai/glm/glm-5.2' in the config finally produced successful routing. The developer recommends always checking a proxy's models endpoint for the exact model ID it expects before configuring LiteLLM prefixes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in