End-to-End Example

One complete flow, two clients: the same chat via the REST API, then the same conversation continued and inspected with the CLI.

1. Send a chat with the REST API

Call the Chat API directly with your secret key:

bash
curl -X POST https://api.carrieros.ai/v1/chat \
  -H "Authorization: Bearer carrier_sk_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "general",
    "message": "Explain OAuth in two sentences."
  }'

The response carries the answer plus a reusable session id:

json
{
  "success": true,
  "data": {
    "id": "…",
    "response": "OAuth is an open standard for delegated access…",
    "session_id": "25f37117-…",
    "tokens_used": 523
  }
}

2. Continue in the CLI

Install, log in with the same key, and open the shell:

bash
npm install -g @carrieros/cli
carrieros login        # paste the same carrier_sk_…
carrieros              # opens the interactive shell

Ask a follow-up — the conversation persists across clients on the same project:

text
❯ Now give me a one-line summary.
● OAuth lets an app access resources on a user's behalf without their password.
☼ Computed in 2s

3. Review sessions

bash
carrieros sessions
text
  Sessions (1 of 1)
  ► OAuth questions       3 msgs · just now · 25f37117

4. Check usage

bash
carrieros usage
text
  Usage · Project A
  Requests        2
  Tokens          745
  Est. cost       $0.004
REST and CLI are interchangeable clients of the same Public API. Any request you make one way is visible to the other — and to the dashboard Usage and Logs.
See the full command set in the CLI Commands reference, and the request pipeline in Authentication Flow.