Sweet! CLI API Reference
Endpoints used by the CLI and billing UI: login/auth, plan/usage, and the OpenAI‑compatible relay.
Overview
This repo does not implement a public “task execution” REST API. The CLI talks to the billing server for auth and an OpenAI‑compatible relay endpoint.
Base URL
https://billing.sweetcli.com
Authentication
After you sign in, the CLI stores a token in ~/.sweet/config.json and sends:
Authorization: Bearer <token>
Endpoints
POST /billing/request-code— request a 6‑digit login codePOST /billing/verify-code— verify code and receive tokenGET /billing/verify-token— validate token and return user infoGET /billing/plan— subscription + trial statusGET /billing/usage/monthly— monthly usage summary
Examples (curl)
curl -X POST https://billing.sweetcli.com/billing/request-code \
-H \"Content-Type: application/json\" \
-d '{\"email\":\"you@example.com\"}'
curl -X POST https://billing.sweetcli.com/billing/verify-code \
-H \"Content-Type: application/json\" \
-d '{\"email\":\"you@example.com\",\"code\":\"123456\"}'
curl -H \"Authorization: Bearer <token>\" \
https://billing.sweetcli.com/billing/plan
Relay (OpenAI-compatible)
The billing server exposes an OpenAI‑compatible endpoint for chat completions:
POST /v1/chat/completions
This endpoint is intended for the official CLI. If you’re building an integration, contact us.