Tokenomics runs an HTTPS server by default. It can auto-generate certificates on first startup or use certificates you provide.
When server.tls.enabled and server.tls.auto_gen are both true (the defaults), Tokenomics generates a full certificate chain on first run:
- A root CA (
ca.crt/ca.key) -- valid for 10 years - A server certificate (
server.crt/server.key) -- valid for 1 year, signed by the root CA
Certificates are stored in the directory specified by server.tls.cert_dir (default: ./certs). On subsequent starts, existing certificates are reused without regeneration.
The server certificate covers:
localhost127.0.0.1::1
| File | Description |
|---|---|
certs/ca.crt |
Root CA certificate (share this for trust installation) |
certs/ca.key |
Root CA private key (keep this secret) |
certs/server.crt |
Server certificate |
certs/server.key |
Server private key |
Since the auto-generated CA is not trusted by default, clients will reject the proxy's certificate. You have three options:
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain ./certs/ca.crtsudo cp ./certs/ca.crt /usr/local/share/ca-certificates/tokenomics-ca.crt
sudo update-ca-certificatessudo cp ./certs/ca.crt /etc/pki/ca-trust/source/anchors/tokenomics-ca.crt
sudo update-ca-trustNot recommended. The run and init commands have an --insecure flag that skips TLS verification:
# Development only!
tokenomics run --insecure claude "test"This is convenient for rapid development but should never be used in production. Prefer Option 1 (install the CA certificate) instead.
See the next section.
To use your own certificate and key, set cert_file and key_file in the config:
server:
tls:
enabled: true
cert_file: "/path/to/server.crt"
key_file: "/path/to/server.key"When cert_file and key_file are both set, auto-generation is skipped entirely. The certificate must be valid for the hostname your agents connect to.
You can also set these via environment variables:
export TOKENOMICS_SERVER_TLS_CERT_FILE="/path/to/server.crt"
export TOKENOMICS_SERVER_TLS_KEY_FILE="/path/to/server.key"To run the proxy over plain HTTP only:
server:
tls:
enabled: false
http_port: 8080Or via environment:
export TOKENOMICS_SERVER_TLS_ENABLED=falseWhen TLS is disabled, the proxy only listens on the HTTP port. Connect agents using --tls=false:
eval $(./bin/tokenomics init --token tkn_abc123 --port 8080 --tls=false)