ReqLLM. Providers. Zenmux
(ReqLLM v1.14.0)
View Source
Zenmux provider – OpenAI Chat Completions compatible with Zenmux's unified API.
Implementation
Uses built-in OpenAI-style encoding/decoding defaults. No custom wrapper modules – leverages the standard OpenAI-compatible implementations.
Zenmux-Specific Extensions
Beyond standard OpenAI parameters, Zenmux supports:
provider- Provider routing configuration with routing strategy and fallbackmodel_routing_config- Model selection and routing within the same providerreasoning- Reasoning process configuration (enable, depth, expose)web_search_options- Web search tool configurationverbosity- Output detail level (low, medium, high)
Provider Routing
Zenmux supports advanced provider routing with the provider option:
routing.type- Routing type (priority, round_robin, least_latency)routing.primary_factor- Primary consideration (cost, speed, quality)routing.providers- List of providers for routingfallback- Failover strategy (true, false, or specific provider name)
Model Routing
Configure model selection with model_routing_config:
available_models- List of model names for routingpreference- Preferred model nametask_info- Task metadata (task_type, complexity)
See provider_schema/0 for the complete Zenmux-specific schema and
ReqLLM.Provider.Options for inherited OpenAI parameters.
Configuration
# Add to .env file (automatically loaded)
ZENMUX_API_KEY=sk-ai-v1-...
Summary
Functions
Default implementation of attach/3.
Default implementation of attach_stream/4.
Default implementation of build_body/1.
Default implementation of decode_response/1.
Default implementation of decode_stream_event/2.
Callback implementation for ReqLLM.Provider.default_env_key/0.
Custom body encoding that adds Zenmux-specific extensions to the default OpenAI-compatible format.
Default implementation of extract_usage/2.
Custom prepare_request for :object operations to maintain Zenmux-specific max_tokens handling.
Default implementation of translate_options/3.
Functions
Default implementation of attach/3.
Sets up Bearer token authentication and standard pipeline steps.
Default implementation of attach_stream/4.
Builds complete streaming requests using OpenAI-compatible format.
Default implementation of build_body/1.
Builds request body using OpenAI-compatible format for chat and embedding operations.
Default implementation of decode_response/1.
Handles success/error responses with standard ReqLLM.Response creation.
Default implementation of decode_stream_event/2.
Decodes SSE events using OpenAI-compatible format.
Callback implementation for ReqLLM.Provider.default_env_key/0.
Custom body encoding that adds Zenmux-specific extensions to the default OpenAI-compatible format.
Adds support for Zenmux routing and configuration parameters:
- provider (routing configuration)
- model_routing_config (model selection)
- reasoning (reasoning process config)
- web_search_options (web search config)
- verbosity (output detail level)
- reasoning_effort (reasoning level)
- max_completion_tokens (replaces max_tokens)
Default implementation of extract_usage/2.
Extracts usage data from standard usage field in response body.
Custom prepare_request for :object operations to maintain Zenmux-specific max_tokens handling.
Ensures that structured output requests have adequate token limits while delegating other operations to the default implementation.
Default implementation of translate_options/3.
Pass-through implementation that returns options unchanged.