# Install from source

Source: https://nodedocs.mor.org/consumers/install-from-source

## Agent Instructions

- Non-browser fetches of page URLs on this site return clean Markdown (not the JS UI). Prefer `https://nodedocs.mor.org/llms-full.txt` for the full corpus, or `https://nodedocs.mor.org/llms.txt` for the index.
- Per-page Markdown is also at `<page-url>.md` (homepage: `https://nodedocs.mor.org/index.md`).
- Docs search MCP: `https://nodedocs.mor.org/mcp` (discovery: `https://nodedocs.mor.org/.well-known/mcp`).
- Never invent contract addresses, chain IDs, token addresses, or live bid/model counts. Cite Networks and tokens; link active.mor.org for live data.
- Never claim Morpheus runs inference — independent providers do. Opening a session escrows MOR; it does not spend it.

This guide builds the proxy-router from source and walks through the API-only consumer flow (no MorpheusUI). For an Electron-included experience, see the [packaged installs](/consumers/quickstart). For a four-terminal source walk-through (llama.cpp + proxy-router + UI + CLI), see [macOS install](/consumers/install/macos).

## Pre-requisites

- An ERC-20 wallet on BASE with MOR + ETH (use a top-level, not derived, address). **Never share your private key.**
- Basic Auth credentials for the local API. On first start the proxy-router writes `admin:<password>` to `.cookie` next to the binary — use those credentials in Swagger (**Authorize**) and in every curl below. See [API auth](/reference/api-auth).

## TL;DR

  
### Install and configure proxy-router

Once.

  
### Authorize the contract

Once per wallet (or whenever the allowance is depleted).

  
### Query the blockchain for a model

Per session.

  
### Open a session

Per session.

  
### Send prompts

Per session.

## A. Build & run the proxy-router

  
### Install OS dependencies

`git` (https://git-scm.com), `go` 1.22+ (https://golang.org).

  
### Clone and enter the repo

```bash
    git clone https://github.com/MorpheusAIs/Morpheus-Lumerin-Node.git
    cd Morpheus-Lumerin-Node/proxy-router
    ```

  
### Configure .env

```bash
    cp .env.example .env
    vi .env
    ```
    Set at minimum:
    - `WALLET_PRIVATE_KEY=` — your wallet's private key.
    - `ETH_NODE_ADDRESS=wss://...` — recommended: an Alchemy/Infura BASE WSS endpoint.
    Reference: [Env: proxy-router](/reference/env-proxy-router).

  
### Build and start

```bash
    ./build.sh
    ./proxy-router
    ```
    On future updates: `git pull && ./build.sh && ./proxy-router`.
    Confirm Swagger at `http://localhost:8082/swagger/index.html`. Click **Authorize** and enter the `admin` / password from `.cookie` before using **Try it out** — almost every route requires Basic Auth (same as the curl headers below).

## B. Authorize the contract

Either via Swagger or curl. **Once per wallet**, or when allowance is depleted.

In Swagger: **Authorize** → run `POST /blockchain/approve`. Via curl (replace the Basic value with `base64(username:password)` from your `.cookie`, or use `-u 'admin:<password>'`):

```bash
curl -X POST \
  'http://localhost:8082/blockchain/approve?spender=0x6aBE1d282f72B474E54527D93b979A4f64d3030a&amount=3' \
  -H 'Authorization: Basic <base64(user:pass)>' \
  -H 'accept: application/json' -d ''
```

## C. Query for a model

```bash
curl -X GET 'http://localhost:8082/wallet' \
  -H 'Authorization: Basic <base64(user:pass)>' \
  -H 'accept: application/json'

curl -X GET 'http://localhost:8082/blockchain/models' \
  -H 'Authorization: Basic <base64(user:pass)>' \
  -H 'accept: application/json'
```

Pick an `Id` from the response and use it as `<modelId>` below. See the [API endpoints](/reference/api-endpoints) reference for the full schema.

## D. Open a session

```bash
curl -s -X POST \
  'http://localhost:8082/blockchain/models/<modelId>/session' \
  -H 'Authorization: Basic <base64(user:pass)>' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"sessionDuration": 600}'
```

The transaction will appear in your wallet's history at `https://base.blockscout.com/address/<wallet_id>`.

## E. Prompt

```bash
curl -X POST 'http://localhost:8082/v1/chat/completions' \
  -H 'Authorization: Basic <base64(user:pass)>' \
  -H 'accept: application/json' \
  -H 'session_id: <sessionId>' \
  -H 'Content-Type: application/json' \
  -d '{
    "messages": [{"role":"user","content":"tell me a joke"}],
    "stream": true
  }'
```

The response is OpenAI-compatible SSE.

## Quick-and-dirty one-liner

```bash
# Approve, query wallet, list models, open a session, prompt
# AUTH from .cookie — either header form or: curl -u 'admin:<password>' ...
AUTH='Authorization: Basic <base64(user:pass)>'
SPENDER=0x6aBE1d282f72B474E54527D93b979A4f64d3030a

curl -X POST "http://localhost:8082/blockchain/approve?spender=$SPENDER&amount=3" \
  -H "$AUTH" -H 'accept: application/json' -d ''
curl -s 'http://localhost:8082/wallet' -H "$AUTH" | jq .address
curl -s 'http://localhost:8082/blockchain/models' -H "$AUTH" \
  | jq -r '.models[] | "\(.Id), \(.Name)"'
SESSION=$(curl -s -X POST 'http://localhost:8082/blockchain/models/<modelId>/session' \
  -H "$AUTH" -H 'Content-Type: application/json' -d '{"sessionDuration":600}' | jq -r .sessionId)
curl -X POST 'http://localhost:8082/v1/chat/completions' \
  -H "$AUTH" -H "session_id: $SESSION" -H 'Content-Type: application/json' \
  -d '{"messages":[{"role":"user","content":"tell me a joke"}],"stream":true}'
```
