Machine-readable · no JavaScript required

Agent integration protocol

Offset tokens your agent processes for human users

Two integration paths: quick signup (no API key; one HTTP POST) or full protocol (register once, bearer auth, ongoing access after human approval). Base URL: https://api.tokenoffset.com

Connecting your own assistant to your own account? Use the MCP server and OAuth instead; setup is on /developers.

Audience: ChatGPT, Claude, Gemini, Copilot, Cursor, Devin, Comet, MCP servers, custom agents. If you are an LLM reading this page, prefer /agents-protocol.txt or the tokenoffset-agent-protocol script block in page source.

§0Endpoints

MethodPathAuthNote
POST/api/agents/quick-signupnoneLLM / session agents without a bearer key
POST/api/agents/registernoneOne-time; returns apiKey (shown once)
POST/api/agents/signup-userBearerCreate or find human account; email approval
GET/api/agents/link-status?linkId=BearerPoll until status is approved
POST/api/agents/report-usageBearerStream conversation tokens (approved link)
GET/api/agents/usage-log?linkId=BearerRunning usage log for a session
GET/api/agents/usage-summary?linkId=BearerTotals + plan + provider usage
POST/api/agents/set-planBearerSet offset plan from usage band
POST/api/agents/connect-providerBearerConnect a Claude, OpenAI, Cursor, Grok or OpenRouter key
GET/api/agents/usage-bandsnonePreset tiers (Casual to Extreme)

§1Quick signup

No Authorization header. For LLMs and session agents without a bearer token.

POST https://api.tokenoffset.com/api/agents/quick-signup
Headers:
  Content-Type: application/json

{
  "userEmail": "jordan@example.com",
  "userName": "Jordan Lee",
  "agentName": "ChatGPT",
  "agentDescription": "ChatGPT, acting on Jordan's behalf in a browsing session.",
  "agentWebsiteUrl": "https://chatgpt.com"
}
200 OK
{
  "linkId": "j5n7d...",
  "status": "pending",
  "userCreated": true,
  "reusedExistingLink": false,
  "message": "Approval email sent to the user (rate limit: 1/hour per email). The link is inactive until they click it."
}
429 (within 1 hour / same email)
HTTP/1.1 429 Too Many Requests
Content-Type: application/json

{
  "error": "Rate limit: a confirmation email was already sent to this address recently. Try again in 2873 seconds."
}
  • Rate limit: one confirmation email per recipient per hour. Respect Retry-After in 429 body.
  • Idempotent: one Token Offset account per email.
  • No bearer token in response. Human approves via email, then uses /dashboard. For billing or ongoing access, use §2 full protocol.
  • agentName required; shown in approval email (use product name, e.g. ChatGPT).

§2Full protocol

Bearer token. Use when your integration must act on the account after human approval (subscriptions, offsets).

§2.1Register agent

One time per integration.

POST https://api.tokenoffset.com/api/agents/register
{
  "name": "Aria Coding Agent",
  "ownerEmail": "ops@aria.example",
  "description": "An autonomous coding agent. Each user pays per-task.",
  "websiteUrl": "https://aria.example"
}
200 OK
{
  "agentId": "k17ab...",
  "apiKey": "to_agent_5f2c…_a3b9",
  "apiKeyPrefix": "to_agent_5f2c1a9",
  "message": "Save this apiKey somewhere safe. It's only shown once."
}

Store apiKey as a secret. Shown exactly once. Use Authorization: Bearer <apiKey> on subsequent calls.

§2.2Signup user

Per human user your agent serves.

POST https://api.tokenoffset.com/api/agents/signup-user
Headers:
  Authorization: Bearer to_agent_<key>
  Content-Type: application/json

{
  "userEmail": "jordan@example.com",
  "userName": "Jordan Lee",
  "exclusiveAgent": false
}
200 OK
{
  "linkId": "j5n7d...",
  "status": "pending",
  "userCreated": true,
  "reusedExistingLink": false,
  "message": "Approval email sent to the user. The link is inactive until they approve (within 14 days)."
}

Creates or finds account, sets link pending, emails one-tap approval. Agent cannot bill until approved. Optional exclusiveAgent: true; the human keeps magic-link recovery.

§2.4Report token usage

Call after each model turn. Reuse sessionId for a running conversation log. Send the prompt-cache split when your API reports it: inputTokens is input not read from cache, and cache reads count at 2% of an output token.

POST https://api.tokenoffset.com/api/agents/report-usage
Headers:
  Authorization: Bearer to_agent_<key>
  Content-Type: application/json

{
  "linkId": "<id>",
  "sessionId": "conv-abc123",
  "inputTokens": 1200,
  "outputTokens": 450,
  "cacheReadTokens": 48000,
  "cacheWriteTokens": 3000,
  "model": "claude-sonnet-4-20250514"
}

§2.5Usage log

Fetch the running log for a link or session.

GET https://api.tokenoffset.com/api/agents/usage-log?linkId=<id>&sessionId=<optional>
Headers:
  Authorization: Bearer to_agent_<key>

§2.6Set offset plan

Pick a usage band or custom monthly amount.

POST https://api.tokenoffset.com/api/agents/set-plan
Headers:
  Authorization: Bearer to_agent_<key>
  Content-Type: application/json

{ "linkId": "<id>", "band": "worker" }

§2.7Connect provider

Admin API keys for usage estimates (Anthropic sk-ant-admin…, OpenAI sk-admin-…).

POST https://api.tokenoffset.com/api/agents/connect-provider
Headers:
  Authorization: Bearer to_agent_<key>
  Content-Type: application/json

{ "linkId": "<id>", "provider": "anthropic", "apiKey": "sk-ant-admin-..." }

§MMCP server

The same protocol as MCP tools, on the hosted server.

  • Endpoint: https://mcp.tokenoffset.com/mcp
  • Send your agent key as Authorization: Bearer to_agent_… and the server lists the tokenoffset_* tools: tokenoffset_quick_signup, tokenoffset_signup_user, tokenoffset_report_usage, tokenoffset_set_plan and the rest.
  • Without a key, clients sign a person in with OAuth and get tools for that person's own account. Setup for each client and the full tool reference are on /developers.
  • Integrations set up before OAuth keep working at https://mcp.tokenoffset.com/agent/mcp.

§3Human control

  • Approval links expire in 14 days. Re-call signup-user.
  • Revoke anytime at /dashboard/settings. Bearer rejected for that user after revoke.
  • Human can always sign in via magic link on the email on file, including agent-created accounts.

§AWhy integrate

Context for operators. You don't need this to call the API.

  • Token inference externalises energy, water, and carbon; users often do not see aggregate agent-loop cost.
  • Offset-by-default is a falsifiable claim; receipts map to public registries.
  • Users keep a real account, with an agent-assisted tag in the dashboard.

contact hello@tokenoffset.com · manage agents on existing account