Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows API server doesn't bind to correct interface - but I can make it do it. #3491

Open
DrJaymz opened this issue Feb 13, 2025 · 0 comments

Comments

@DrJaymz
Copy link

DrJaymz commented Feb 13, 2025

API not contactable outside of machine. If there are multiple interfaces or Hyper-V virtual switch then cannot get it to listen on the correct interface. Do not seem to be able to set this on the CLI or get it to listen on all interfaces. I would expect by default to bind to 0.0.0.0 - so we don't need to worry about it.

Steps:

Localhost OK:
curl -X POST http://localhost:4891/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "Llama-3-8B-Instruct", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}]}'
{"choices":[{"finish_reason":"stop","index":0,"logprobs":null,"message":{"content":"The capital of France is Paris.","role":"assistant"},"references":null}],"created":1739447845,"id":"placeholder","model":"Llama 3 8B Instruct","object":"chat.completion","usage":{"completion_tokens":7,"prompt_tokens":30,"total_tokens":37}} ✔

Actual IP No good:
curl -X POST http://192.168.0.100:4891/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "Llama-3-8B-Instruct", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}]}'

Using Windows 11 - Workaround manually connect up:
$ netsh interface portproxy add v4tov4 listenport=4891 listenaddress=0.0.0.0 connectport=4891 connectaddress=127.0.0.1

Now:
curl -X POST http://192.168.0.100:4891/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "Llama-3-8B-Instruct", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is the capital of France?"}]}'
{"choices":[{"finish_reason":"stop","index":0,"logprobs":null,"message":{"content":"The capital of France is Paris!","role":"assistant"},"references":null}],"created":1739448277,"id":"placeholder","model":"Llama 3 8B Instruct","object":"chat.completion","usage":{"completion_tokens":7,"prompt_tokens":30,"total_tokens":37}}

There is probably something obvious but I checked the documentation and didn't find the answer or a similar question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant