Routing Strategy
Understand GPT-Load's path processing mechanism, master flexible path configuration methods to ensure proper connection between clients and upstream services.
Path Processing Principles
Transparent Principle
GPT-Load follows the transparent principle, only responsible for path replacement while maintaining maximum flexibility. The core logic is to replace the proxy prefix in client requests with the actual upstream address.
Replacement Rule: GPT-Load Service Address + /proxy/ + Group Name Replaced with Upstream Address
Processing Flow Example
http://localhost:3001
https://api.test.com
test
http://localhost:3001/proxy/test/v1/chat/completions
https://api.test.com/v1/chat/completions
Configuration Methods
Using OpenRouter as an example (full path: https://openrouter.ai/api/v1/chat/completions), group name is openrouter, channel type is openai:
Configuration Method 1: Domain Separation
GPT-Load Configuration
https://openrouter.ai
/api/v1/chat/completions
Client Configuration
http://localhost:3001/proxy/openrouter/api
Configuration Method 2: Include API Path (Recommended)
GPT-Load Configuration
https://openrouter.ai/api
/v1/chat/completions
Client Configuration
http://localhost:3001/proxy/openrouter
Configuration Method 3: Complete Version Path
GPT-Load Configuration
https://openrouter.ai/api/v1
/chat/completions
Client Configuration
http://localhost:3001/proxy/openrouter/
Note: Must end with /, avoid client auto-appending v1 path
Best Practices
Configuration Suggestions
- • Recommend using configuration method 2 for clear structure
- • First determine the complete upstream API address
- • Choose appropriate path split point based on client characteristics
- • Maintain configuration consistency and maintainability
Debugging Tips
- • Check GPT-Load request logs to confirm upstream address
- • Use test path to verify configuration correctness
- • Pay attention to client path concatenation rules
- • Flexibly adjust configuration to adapt to different scenarios
Configuration Summary
Understanding path processing logic is key: GPT-Load only handles simple string replacement, flexible configuration methods can adapt to various client and upstream service needs.