Skip to content

Feedback for “Local API Server” #7345

@therealmonadnomad

Description

@therealmonadnomad

What i am trying to do:
use LibreChat in a container on my laptop to access Jan.AI on my GPU-enabled server.

What error i get when attempting to use LibreChat:
Something went wrong. Here's the specific error message we encountered: An error occurred while processing the request: 403 Invalid host header

How I can duplicate the error with curl:
curl -X 'GET' 'http://aibox:1337/v1/models' -H 'accept: application/json' -H 'Authorization: Bearer [secret]'
returns: "Invalid host header"
(I checked name resolution & that the port is open)

How I can work-around with curl:
curl -X 'GET' 'http://aibox:1337/v1/models' -H 'accept: application/json' -H 'Authorization: Bearer [secret]' --header 'Host: localhost'
returns: the name of the currently loaded model as JSON

Further comment on the curl testing:
I get the same results using curl on the aibox. If i use hostname, or IP address, i need to add the host header localhost to get results. This further cements my thoughts on where it issue lies...

My theory:
Jan.AI API server seems to want the incoming http request to have a host header of localhost. Does that even make sense? If the answer is, "Yes it does require that, there is a good reason, " can someone please explain that good reason?

Here's my LibreChat config to point at my Jan.AI server:

custom:
    - name: "SilverPCJanAI"
      apiKey: "[secret]"
      baseURL: "http://aibox:1337/v1/chat/completions"
      models:
        default: ["Gemma-The-Writer-N-Restless-Quill-10B-D_AU-IQ4_XS"]
      titleConvo: true
      titleModel: "Gemma-The-Writer-N-Restless-Quill-10B-D_AU-IQ4_XS"
      modelDisplayLabel: "Custom AI"

Again, I've verified name resolution and connectivity between the two computers. I get the same results if i test using IP address instead of a hostname.

A few relevant Jan.AI Local API Server settings:
Server host: 0.0.0.0
Server Port: 1337
Trusted Hosts: 10...*

Metadata

Metadata

Assignees

No one assigned

    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