Skip to content

allow llama serve -hf to use llama-server in router mode #26116

Open

Description

@ngxson

Allow llama serve -hf to use llama-server in router mode

Behavior:

  • llama serve -hf will run a new llama-server in router mode if one doesn't yet exist
  • if there was already a server, then reuse it
  • models that don't yet exist in cache should be downloaded automatically

Some considerations (TBD):

  • server should run on which port? --> port 9931 == "ggml"
  • maybe add a "model name resolve" API; for example, input user/model without tag resolve to user/model:Q4_K_M

(this is an assigned issue; contributor should not take it)

Activity

  1. self-assigned this
    on Jul 25, 2026
  2. EJainDev commented on Aug 3, 2026

    @EJainDev

    How will this work (especially with on-demand downloads) for model configuration? Right now it's a fixed cache so a models.ini handles the configuration fine.

  3. woof-dog commented on Aug 16, 2026

    @woof-dog
    Contributor

    I would like to point out that I currently enjoy the current llama-server setup in which I feel like I have control over which models I have and where I got the models from (not necessarily Hugging Face). I also have control over how llama-server is run.

    I am personally not interested in having it run as a daemon only, or in having another ollama. Being able to Ctrl+C the process and view the logs as they stream in are actual UX benefits I rely on, especially when other software is accessing the llama.cpp server.

  4. mcneiljt commented on Aug 17, 2026

    @mcneiljt

    Echoing @woof-dog a bit here.

    Is there more context on why this is changing? Can this change be made without dramatically affecting how llama-server operates today?

  5. stevecs commented on Aug 23, 2026

    @stevecs

    Just a comment here as I just started using llama.cpp directly, but saw the note on the default port change from 8080 -> 9931 but doing a quick search did NOT see any hits/lookups at IANA that this new port number was going through the registration process. Any port < 49152 should be registered if used on a project and is for a unique application/service/function. This helps identification and management of flows through application aware firewalls (so custom service checks, etc can be assigned or excluded for particular ports). Since this seems to be just http traffic but on a different port would argue against changing this from 80/8080 normal web ports or if needed to a port > 49152 as otherwise if unregistered will just be laying a future land-mine when that port IS registered via the correct channels.

  6. ngxson commented on Aug 23, 2026

    @ngxson
    CollaboratorAuthor

    To clarify:

    llama-server will work as-is, the only thing change is llama serve command, as the title of this issue suggested

    The change from 8080 to 9931 is because 8080 is a generic port that might be used by other apps. This is mostly for better UX, not just a technical change. That being said, (1) many other apps also use ports not registered on IANA and (2) even if there are conflict, usually with too obscure app that less than 1% users gonna use, and (3) user can always set explicit --port, that option is not going anywhere

    So I don't see any other blocking issues for this feature.

  7. woof-dog commented on Aug 23, 2026

    @woof-dog
    Contributor

    llama-server will work as-is

    Thank you for clarifying. But many of us likely came from #26508 after noticing the server log, and in that PR you wrote that this issue was

    transitioning llama-server from an on-demand command to a daemon process

    which sounds exactly like llama-server was being replaced with llama serve.

    So, I am glad you clarified this is not actually the case.

  8. ngxson commented on Aug 23, 2026

    @ngxson
    CollaboratorAuthor

    the only thing gonna change on llama-server will be just the --port because defaulted to 9931. users can always set LLAMA_ARG_PORT=8080 env var to bashrc (or similar) force it use the port 8080 without explicit --port

  9. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

    This issue was closed because it has been inactive for 14 days since being marked as stale.

  10. reopened this on Oct 7, 2026
  11. danielzgtg commented on Oct 18, 2026

    @danielzgtg
    Contributor

    I am annoyed that the port changed for not good enough reasons. A port change would force me to inconveniently reconfigure my firewall, bookmarks, IDEs, and other agents.

    The change from 8080 to 9931 is because 8080 is a generic port that might be used by other apps. [...] (3) user can always set explicit --port, that option is not going anywhere

    Most people were previously fine with port 8080. I think that the burden should be placed on whoever wants port 9931 to specify that option.

  12. danielzgtg commented on Oct 19, 2026

    @danielzgtg
    Contributor

    I've just hit a hard problem. Firefox's localhost AI is hardcoded to localhost:8080. I can't find a way to reconfigure it.

    localhost:8080 AI unable to connect

    So now when people update llama.cpp, their Firefox AI will stop working. If they're following instructions older than 2 months, it'll lack --port 8080 and they'll be confused. Furthermore, I'm not going to submit a patch to Firefox, because another OpenAI-compatible LLM server might be still using port 8080.

  13. ArclightMat commented on Oct 19, 2026

    @ArclightMat

    @danielzgtg Considering enabling localhost as a chat provider in Firefox isn't exposed in the normal UI, I assume you're aware of about:config. You just need to update browser.ml.chat.provider to the new port, there is no need to patch upstream behavior.

    It is not hardcoded, and the upstream default could be changed if Mozilla finds it sensible enough.

    This default did work for llama.cpp because it has a WebUI on the same port as the API, otherwise if it were vLLM, TabbyAPI, etc. you would need to put your frontend on port 8080 or change the config flag either way. Pointing a plain OpenAI compatible API wouldn't work at all. And again, this isn't exposed to end users, so they must be aware on how to configure things.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions