TL;DR

  • → AgentGen hosts your Tesla virtual public key for free — no GitHub Pages, no Tailscale, no server
  • → Install teslacli in one command and set up full Vehicle Command Protocol (VCP) in minutes
  • → Lock, unlock, control climate, and manage charging from your terminal or any script

Control Your Tesla for Free with AgentGen

Tesla's Fleet API requires you to serve a public key at a publicly reachable HTTPS URL before your app can send signed commands to the car. Most guides tell you to set up GitHub Pages or a VPS. AgentGen gives you a free, permanent subdomain for exactly this purpose — provisioned in seconds with a single API call.

Why does Tesla need a public key?

Modern Tesla vehicles use the Vehicle Command Protocol (VCP) — a signed, encrypted channel over BLE and the Tesla backend. Before any signed command is accepted, the car must have your public key enrolled as a "virtual key." Tesla verifies that the key is genuinely yours by fetching it from a well-known HTTPS path under your registered domain.

That means you need something serving your PEM-encoded public key at:

https://<your-domain>/.well-known/appspecific/com.tesla.3p.public-key.pem

AgentGen provisions a subdomain (abc123.agent-gen.com) and serves this file for you — for free, forever, with no infrastructure to maintain.

Step 1 — Create a free AgentGen account

Origin hosting (the subdomain + public-key serving) is completely free and does not consume any tokens. You only need a free account to get an API key.

Step 2 — Install teslacli

The installer detects your OS and architecture automatically, downloads the latest release binary from GitHub, installs it to /usr/local/bin, and immediately launches the setup wizard.

curl -fsSL https://raw.githubusercontent.com/Agent-Gen-com/tesla-cli/main/install.sh | sh

Supports macOS (Intel & Apple Silicon) and Linux (x86_64 & ARM64). To build from source instead, see the GitHub repo.

Step 3 — Run the teslacli setup wizard

The installer launches it automatically, or you can run it manually:

teslacli setup

The wizard walks you through 6 steps:

  1. Setup mode — choose User flow (opens browser locally) or Agent flow (prints shareable links, suitable for headless/remote machines)
  2. AgentGen origin — paste your AgentGen API key; the CLI calls the AgentGen API to provision your subdomain and will serve your public key there automatically
  3. Tesla Developer App — enter your client_id, client_secret, and region. Register your app first at developer.tesla.com
  4. EC key pair — generates a P-256 key pair locally, uploads the public key to AgentGen, then opens the Tesla enrollment URL so you can approve the key in the Tesla app
  5. Partner registration — registers your app with the Tesla Fleet API using client credentials
  6. OAuth login — authenticates your Tesla account and saves tokens to ~/.config/teslacli/token.json

Files created by setup

~/.config/teslacli/
├── config.toml          # App credentials, region, AgentGen origin
├── token.json           # OAuth tokens (auto-refreshed)
└── keys/
    ├── private.pem      # P-256 private key (mode 0600)
    └── public.pem       # Public key (served by AgentGen)

Step 4 — Control your Tesla

Once setup is complete, every command is a single line:

Vehicle

teslacli vehicle list          # list all vehicles on your account
teslacli vehicle data          # full vehicle snapshot (JSON)
teslacli vehicle wake          # wake the car
teslacli vehicle lock          # lock doors (VCP signed)
teslacli vehicle unlock        # unlock doors (VCP signed)
teslacli vehicle flash         # flash headlights
teslacli vehicle honk          # honk horn

Climate

teslacli climate start         # turn climate on
teslacli climate stop          # turn climate off
teslacli climate set-temp -t 22.5  # set cabin to 22.5 °C

Charging

teslacli charge start          # start charging
teslacli charge stop           # stop charging
teslacli charge set-limit -l 80    # set charge limit to 80 %
teslacli charge set-amps -a 16     # set current to 16 A

How AgentGen fits in

Under the hood, teslacli setup makes two calls to the AgentGen API:

  1. POST /v1/origin — provisions a unique subdomain (e.g. abc123.agent-gen.com)
  2. POST /v1/origin/{id}/public-key — uploads your PEM public key so it's served at the Tesla-expected path

Both calls are free. No tokens are consumed. The subdomain and public key persist indefinitely — you never have to touch it again.

If you later rotate your keys, re-running teslacli setup uploads a new public key to the same origin and re-enrolls it on the vehicle.

Troubleshooting

"Key not enrolled on vehicle"

The virtual key approval step was skipped. Re-run teslacli setup and approve the key in the Tesla app when the enrollment URL opens.

"Token expired — run teslacli setup"

Tesla refresh tokens expire after ~45 days of inactivity. Re-run teslacli setup to reauthenticate.

"Handshake HTTP 408"

The vehicle subsystem didn't respond in time — usually because the car just woke up. Run teslacli vehicle wake, wait a few seconds, and retry.

Start controlling your Tesla today

Create a free account — origin hosting is free and never expires. No credit card required.