# What Are the Default Ports for FreeLLMAPI?

> Discover the default ports for FreeLLMAPI. Learn about port 31415 for the desktop router and port 3001 for API and dashboard services.

- Repository: [Tashfeen/freellmapi](https://github.com/tashfeenahmed/freellmapi)
- Tags: how-to-guide
- Published: 2026-08-26

---

**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`](https://github.com/tashfeenahmed/freellmapi/blob/main/desktop/src/main.ts), the constant `DEFAULT_PORT` is explicitly set to `31415` and resolves to the loopback interface for local access only.

```typescript
// 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`](https://github.com/tashfeenahmed/freellmapi/blob/main/docs/install.md) and the Docker configuration in [`docker/README.md`](https://github.com/tashfeenahmed/freellmapi/blob/main/docker/README.md), the Express server and bundled frontend bind to this port when running via Docker Compose.

```bash

# 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.

```bash

# 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`](https://github.com/tashfeenahmed/freellmapi/blob/main/desktop/src/main.ts).

```bash

# 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:

```bash
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`](https://github.com/tashfeenahmed/freellmapi/blob/main/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`](https://github.com/tashfeenahmed/freellmapi/blob/main/docs/install.md) and [`docker/README.md`](https://github.com/tashfeenahmed/freellmapi/blob/main/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`](https://github.com/tashfeenahmed/freellmapi/blob/main/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`](https://github.com/tashfeenahmed/freellmapi/blob/main/docs/install.md)) and the Docker README ([`docker/README.md`](https://github.com/tashfeenahmed/freellmapi/blob/main/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`](https://github.com/tashfeenahmed/freellmapi/blob/main/docker-compose.yml) configuration; by default it maps to localhost but can be exposed externally through explicit port binding.