Skip to content

Conversation

@davidlambl
Copy link

This PR addresses an issue where API hostname configuration causes connection errors with llama-cpp-python servers (showing errors like "Cannot connect to host http:80").

Changes Made:

  • Modified the format_url function in utils.py to properly handle URL construction
  • Added protocol stripping from hostnames to prevent duplication
  • Improved port handling to ensure correctly formatted URLs
  • Ensures proper URL formation for all combinations of hostname/port/protocol

Testing:

  1. Tested with a llama-cpp-python server on LAN at http://192.168.1.100:8000
  2. Configure with protocol in hostname (e.g., "http://192.168.1.100:8000")
  3. Configure without protocol (e.g., "192.168.1.100" with port "8000")
  4. Test with and without port specifications
  5. Verify connection succeeds with properly formatted URLs

Fixes #220

@acon96
Copy link
Owner

acon96 commented Sep 27, 2025

This PR is out of date

@acon96 acon96 closed this Sep 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problems with API Hostname Configuration Leading to Connection Errors in OpenRouter.ai

2 participants