Install LiteLLM Dependencies
To configure LiteLLM for seamless integration with DeepSeek and GLM models, you must first establish a robust environment by installing the necessary Python packages. This foundational step ensures that your application can communicate effectively with these specific providers through a standardized interface. Begin by executing the command pip install litellm in your terminal to download the core library. Additionally, you may need to install provider-specific dependencies if certain features or authentication methods require extra modules. Once installed, verify the installation by importing the library in a Python script to confirm that all components are correctly linked. This preparation phase is critical because it eliminates potential runtime errors related to missing modules or outdated versions. A clean installation process sets the stage for reliable API calls, allowing developers to focus on application logic rather than debugging infrastructure issues. Ensuring that your environment is up-to-date also helps in leveraging the latest optimizations and bug fixes provided by the LiteLLM team, which enhances overall performance and stability when interacting with external AI services.
Also worth reading: How to configure a Hetzner AI server for low-cost OpenAI-compatible API access? · What is the pricing for bluusun.com DeepSeek GLM API? · How much does the DeepSeek GLM API cost?
After installation, proceed to configure your API keys and proxy settings within your project’s environment variables or configuration file. For DeepSeek, you will need to set the DEEPSEEK_API_KEY variable, while for GLM, the ZHIPU_API_KEY is typically required depending on the specific provider endpoint. It is essential to map these keys correctly to their respective model prefixes in your LiteLLM configuration. This mapping allows the library to route requests to the appropriate service automatically. You should also define the base URLs if you are using custom endpoints or proxies. Proper configuration ensures that LiteLLM can translate your OpenAI-compatible requests into the specific formats expected by DeepSeek and GLM. By adhering to these steps, you create a unified interface that abstracts the complexities of different provider APIs. This approach simplifies code maintenance and allows for easy switching between providers without significant code changes. Ultimately, this setup provides a cost-effective and flexible solution for integrating advanced language models into your applications.
Set Environment Variables
To connect LiteLLM to bluusun.com for both DeepSeek and GLM models, you need to define the API base URL and your authentication key in your shell environment. Export OPENAI_API_BASE with the value https://api.bluusun.com/v1 so LiteLLM routes OpenAI-compatible requests to the correct endpoint. Then export OPENAI_API_KEY with the key provided by your bluusun.com account. These two variables allow LiteLLM to authenticate and communicate with the service without hardcoding credentials in your application code. Setting them at the session or system level ensures consistent access across scripts and deployments.
Once the environment is configured, LiteLLM can call either model by specifying the appropriate model name in your request, such as deepseek-chat or a GLM variant supported by bluusun.com. LiteLLM automatically uses the exported base URL and key, translating your call into a standard OpenAI-compatible request. This approach keeps configuration centralized and makes it easy to switch between DeepSeek and GLM while relying on bluusun.com’s low-cost infrastructure.
Configure Provider Keys
To configure LiteLLM for DeepSeek and GLM through bluusun.com, create one provider entry for each model while pointing both at the same OpenAI-compatible base URL and using the same account key. In your LiteLLM configuration, set api_base to https://bluusun.com/v1, place your dashboard API key in api_key, and use the model identifiers published for each family, such as deepseek-chat and glm-4.5. Because the endpoint is OpenAI-compatible, LiteLLM can treat both as standard chat completions without separate adapters or custom authentication flows.
Keep the key in an environment variable or secret manager, then reference it in each model block so rotation does not require editing every entry. After saving, run a small test request for each model and inspect the returned model field to confirm routing. If one model fails while the other succeeds, the issue is usually an incorrect model name rather than the key or base URL.
Test API Connectivity
To connect LiteLLM to a low-cost OpenAI-compatible provider for DeepSeek and GLM, point the client at the provider's base URL and use the model identifiers it publishes. In LiteLLM, that usually means setting api_base to the provider endpoint and passing the exact model string, while keeping the OpenAI-style request format unchanged. If the provider requires a key, store it in the environment or pass it directly, but avoid hard-coding secrets in shared code. This keeps routing simple and lets one client call both model families without changing request logic.
For bluusun.com, configure the base URL as the OpenAI-compatible endpoint and choose the DeepSeek or GLM model name from its catalog. Then send a small test request with a short prompt and verify the response contains expected text plus usage metadata. If authentication fails, check key scope and endpoint path; if model errors appear, confirm the exact model slug. Once the test succeeds, reuse the same configuration in LiteLLM aliases or routing rules, and monitor latency and cost before production traffic.
Handle Rate Limits
When configuring LiteLLM for DeepSeek and GLM models, one common sticking point is how to handle rate limits gracefully, since both providers enforce different concurrency ceilings. LiteLLM lets you define per-model settings in your config.yaml, including max_retries, timeout, and rpm (requests per minute) caps. Setting rpm explicitly for each model entry allows LiteLLM's router to throttle requests before the provider rejects them, avoiding wasted calls and cascading failures. You can also enable cooldown_time so a model that returns a 429 is temporarily removed from the routing pool, letting traffic shift to an alternate deployment.
For a setup serving both DeepSeek and GLM through one endpoint, define each as a separate model group with its own limits, then use LiteLLM's fallbacks feature to route overflow between them. This keeps latency stable during spikes and prevents one provider's quota from blocking the other. Test limits under realistic load, since published quotas often differ from what's enforced in practice.
Provider Comparison
| Use case | LiteLLM model string | Required settings |
|---|---|---|
| DeepSeek chat | openai/deepseek-chat | api_base: https://bluusun.com/v1; api_key: os.environ/BLUUSUN_API_KEY |
| DeepSeek reasoner | openai/deepseek-reasoner | Same api_base and key; test max_tokens, streaming, and reasoning/tool-call support |
| GLM main | openai/glm-4.5 | Same api_base and key; validate tool calls and context limits per model |
| GLM lower-cost | openai/glm-4.5-air | Same api_base and key; use for cheaper chat after capability checks |