Compare commits

..
Author SHA1 Message Date
9qeklajc 0ff2f992b0 enforce model price calculation 2026-04-10 15:34:52 +02:00
4 changed files with 59 additions and 41 deletions
+7 -19
View File
@@ -51,26 +51,14 @@ curl https://api.routstr.com/v1/chat/completions \
## Quick Start (Docker)
If you are a node runner, start a Routstr Core instance using Docker Compose:
If you are a node runner, start a Routstr Core instance and configure upstream access in the dashboard.
1. **Prepare your `.env`**:
```bash
ADMIN_PASSWORD=mysecretpassword
NAME="My AI Node"
DESCRIPTION="Fast access to models"
NSEC=yournsec
RECEIVE_LN_ADDRESS=yourname@wallet.com
```
2. **Start the services**:
```bash
docker compose up -d
```
3. **Configure**:
Open [http://localhost:8000/admin/](http://localhost:8000/admin/) to connect your AI providers and set pricing.
For full instructions, see the **[Provider Quick Start Guide](https://docs.routstr.com/provider/quickstart/)**.
```bash
docker run -d \
--name routstr-proxy \
-p 8000:8000 \
ghcr.io/routstr/proxy:latest
```
## Development
+18 -5
View File
@@ -6,7 +6,16 @@ Production deployment guide for Routstr Provider nodes.
For production, use Docker Compose with persistent storage and optional Tor support.
Use the included `compose.yml` for a flexible setup that handles both the UI and the node execution. This is useful for development or when you want to manage Tor as a separate service.
### Unified Setup (All-in-one)
To build and run the node with the UI integrated in a single container using the multi-stage build:
```bash
docker build -f Dockerfile.full -t routstr-full .
docker run -d -p 8000:8000 --env-file .env routstr-full
```
### Advanced Setup (Separated UI & Node)
Use the included `compose.yml` for a more flexible setup that separates the UI build process from the node execution. This is useful for development or when you want to manage Tor as a separate service.
```bash
docker compose up -d
@@ -175,16 +184,20 @@ docker compose up -d
## Building from Source
### Using Docker Compose
The easiest way to build everything from source:
### Unified Image (UI + Node)
The easiest way to build everything from source into a single production-ready image:
```bash
docker compose build
docker build -f Dockerfile.full -t routstr-full .
```
### Individual Components
If you prefer building the node only (requires manual UI build first):
If you prefer building them separately or using Docker Compose:
```bash
# Build using compose
docker compose build
# Or build the node only (requires manual UI build first)
docker build -t routstr-node .
```
+24 -12
View File
@@ -35,7 +35,6 @@ ADMIN_PASSWORD=mysecretpassword
# Node Identity
NAME="My AI Node"
DESCRIPTION="Fast access to models"
NSEC=yournsec
# Lightning Payouts
RECEIVE_LN_ADDRESS=yourname@wallet.com
@@ -44,10 +43,32 @@ RECEIVE_LN_ADDRESS=yourname@wallet.com
## 2. Start the Node
The recommended way to run Routstr is using Docker Compose, which handles the node, the UI, and optional services like Tor.
You can run the pre-built image directly:
```bash
docker compose up -d
docker run -d \
--name routstr \
-p 8000:8000 \
--env-file .env \
-v routstr-data:/app/data \
ghcr.io/routstr/proxy:latest
```
*Note: The pre-built image does not contain the UI. For the all-in-one experience with the Admin Dashboard, use the Build from Source instructions below.*
### Build from Source (Recommended)
If you want to build the node and UI yourself from source, use the unified Dockerfile:
```bash
git clone https://github.com/routstr/routstr-core.git
cd routstr-core
# Edit your .env with ADMIN_PASSWORD and API keys
cp .env.example .env
nano .env
docker build -f Dockerfile.full -t routstr-local .
docker run -d -p 8000:8000 --env-file .env --name routstr routstr-local
```
Verify it's running:
@@ -56,15 +77,6 @@ Verify it's running:
curl http://localhost:8000/v1/info
```
### Build from Source (Optional)
If you've cloned the repository and want to build the images yourself:
```bash
docker compose build
docker compose up -d
```
---
## 3. Configure via Dashboard
+10 -5
View File
@@ -182,11 +182,16 @@ def _row_to_model(
)
if apply_provider_fee:
(
parsed_pricing.max_prompt_cost,
parsed_pricing.max_completion_cost,
parsed_pricing.max_cost,
) = _calculate_usd_max_costs(model)
max_prompt, max_completion, max_cost = _calculate_usd_max_costs(model)
parsed_pricing = Pricing(
**{
**parsed_pricing.dict(),
"max_prompt_cost": max_prompt,
"max_completion_cost": max_completion,
"max_cost": max_cost,
}
)
model = Model(**{**model.dict(), "pricing": parsed_pricing, "sats_pricing": None})
try:
sats_to_usd = sats_usd_price()