What Are the Default Ports for FreeLLMAPI?

FreeLLMAPI uses port 31415 for the desktop router and port 3001 for the API and dashboard services.

FreeLLMAPI is an open-source LLM routing platform developed by tashfeenahmed that exposes two distinct networking interfaces depending on your deployment mode. Understanding the default ports for FreeLLMAPI is essential for firewall configuration, reverse proxy setup, and avoiding conflicts with existing local services.

Default Ports for FreeLLMAPI Components

Desktop Router (Port 31415)

The desktop application runs a local router server that binds to 31415 by default. In desktop/src/main.ts, the constant DEFAULT_PORT is explicitly set to 31415 and resolves to the loopback interface for local access only.

// desktop/src/main.ts
import cfg from './config';

const DEFAULT_PORT = 31415;
let resolvedPort = cfg.port ?? DEFAULT_PORT;   // cfg.port can be set in the UI or via config file

This port is restricted to localhost (127.0.0.1) and handles routing between the desktop UI and local LLM endpoints.

API and Dashboard (Port 3001)

The containerized API and React dashboard listen on 3001 by default. According to the installation documentation in docs/install.md and the Docker configuration in docker/README.md, the Express server and bundled frontend bind to this port when running via Docker Compose.


# Default port mapping in Docker

docker run -p 3001:3000 freellmapi/api

How to Change FreeLLMAPI Default Ports

Overriding the Docker API Port

You can override the default 3001 port using the PORT environment variable before starting the containers. The Docker Compose file reads this variable and falls back to 3001 if omitted.


# Set a custom port before starting the containers

export PORT=8080
docker compose up -d

Configuring the Desktop Port

For the desktop application, pass a custom port through the cfg.port configuration option, which takes precedence over the DEFAULT_PORT constant defined in desktop/src/main.ts.


# Example: launch the desktop app with a custom port

freellmapi launch --port 4000

Alternatively, modify the port via the application's settings UI or configuration file, which updates the cfg.port property referenced in the main process.

Verifying Active Ports via CLI

To confirm which ports are currently in use by FreeLLMAPI services, use the built-in status command:

npx freellmapi status

# Output includes:

#   API & Dashboard: http://127.0.0.1:3001

#   Desktop router: http://127.0.0.1:31415

Summary

  • Port 31415 is the default for the desktop router (defined in desktop/src/main.ts), listening on localhost only.
  • Port 3001 is the default for the Docker-based API and dashboard (documented in docs/install.md and docker/README.md).
  • Override Docker ports using the PORT environment variable.
  • Override desktop ports using cfg.port configuration or CLI flags.

Frequently Asked Questions

What is the default port for FreeLLMAPI desktop?

The desktop router binds to 31415 by default. This is hardcoded as DEFAULT_PORT = 31415 in desktop/src/main.ts and can be customized via the cfg.port configuration property.

What port does the FreeLLMAPI API and dashboard use?

The API and bundled React dashboard run on 3001 by default when deployed via Docker. This is specified in the installation documentation (docs/install.md) and the Docker README (docker/README.md).

How do I override FreeLLMAPI default ports?

For Docker deployments, set the PORT environment variable before running docker compose up. For the desktop application, specify a custom port through the cfg.port configuration option or launch flags, which overrides the DEFAULT_PORT constant in the Electron main process.

Are FreeLLMAPI ports exposed to external networks?

The desktop router (port 31415) binds to the loopback interface (127.0.0.1) only and is not exposed externally. The Docker API (port 3001) binding depends on your docker run or docker-compose.yml configuration; by default it maps to localhost but can be exposed externally through explicit port binding.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →