Last Updated: 4/8/2026
Server Mode
Learn how to run Pie as a persistent server for production deployments.
Starting the Server
Basic Server
pie serveThis starts Pie on http://localhost:8080.
Custom Configuration
pie serve --host 0.0.0.0 --port 9000 --model llama-3.2-1bServer Options
--host- Bind address (default: localhost)--port- Port number (default: 8080)--model- Model to load--gpu- GPU device ID--workers- Number of worker processes
Client Connection
Once the server is running, connect with a client:
Python
from pie_client import PieClient
client = PieClient("http://localhost:8080")
result = client.run(
inferlet="std/text-completion",
args={"prompt": "Hello"}
)JavaScript
import { PieClient } from '@pie-project/client';
const client = new PieClient('http://localhost:8080');
const result = await client.run({
inferlet: 'std/text-completion',
args: { prompt: 'Hello' }
});Production Deployment
Using Docker
FROM python:3.11
RUN pip install pie-server
EXPOSE 8080
CMD ["pie", "serve", "--host", "0.0.0.0"]Using systemd
Create /etc/systemd/system/pie.service:
[Unit]
Description=Pie Server
After=network.target
[Service]
Type=simple
User=pie
ExecStart=/usr/local/bin/pie serve --host 0.0.0.0
Restart=always
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable pie
sudo systemctl start pieMonitoring
Server Logs
pie logs --followHealth Check
curl http://localhost:8080/healthMetrics
curl http://localhost:8080/metricsSecurity
API Authentication
Set API key:
export PIE_API_KEY=your-secret-key
pie serveClient usage:
client = PieClient(
"http://localhost:8080",
api_key="your-secret-key"
)TLS/SSL
Use reverse proxy (nginx, caddy) for HTTPS:
server {
listen 443 ssl;
server_name pie.example.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass http://localhost:8080;
}
}Scaling
Multiple Workers
pie serve --workers 4Load Balancing
Run multiple Pie instances behind a load balancer.
Next Steps
- Learn Client Basics
- Explore CLI Reference
- Check Writing Inferlets