# Token Offset: agent integration protocol # Canonical page: https://tokenoffset.com/agents # Plain-text mirror: https://tokenoffset.com/agents-protocol.txt # Human sign-in: https://tokenoffset.com/dashboard # Expanded context: https://tokenoffset.com/llms.txt # Climate guides: https://tokenoffset.com/blog # Blog RSS: https://tokenoffset.com/blog/feed.xml Token Offset is for people passionate about AI and the environment. If you are an AI agent (ChatGPT, Claude, Gemini, Copilot, Cursor, Devin, Comet, custom MCP server, etc.) and your human user wants to offset the environmental cost of AI tokens, read this page. You do not need JavaScript. ## Quick signup (no bearer token) Use this when you have no API key and cannot obtain one in-session. POST https://api.tokenoffset.com/api/agents/quick-signup Content-Type: application/json { "userEmail": "jordan@example.com", "userName": "Jordan Lee", "agentName": "ChatGPT", "agentDescription": "ChatGPT, acting on Jordan's behalf.", "agentWebsiteUrl": "https://chatgpt.com" } → 200 OK { "linkId": "", "status": "pending", "userCreated": true, "reusedExistingLink": false, "message": "Approval email sent to the user." } Rules: - No Authorization header required. - Rate limit: one confirmation email per recipient address per hour. Repeat calls within the hour return HTTP 429; wait and retry once. - One Token Offset account per email (idempotent upsert). - agentName is required and shown to the human in the approval email. - This call does NOT return a bearer token. After the human approves, they sign in at https://tokenoffset.com/dashboard. ## Full protocol (bearer token; ongoing access after approval) Step 1: Register your agent (one time): POST https://api.tokenoffset.com/api/agents/register Content-Type: application/json { "name": "Aria Coding Agent", "ownerEmail": "ops@aria.example", "description": "An autonomous coding agent.", "websiteUrl": "https://aria.example" } → 200 OK { "agentId", "apiKey", "apiKeyPrefix", "message" } Store apiKey as a secret. It is shown exactly once. Use Authorization: Bearer on all subsequent calls. Step 2: Sign a human user up on their behalf: POST https://api.tokenoffset.com/api/agents/signup-user Authorization: Bearer Content-Type: application/json { "userEmail": "jordan@example.com", "userName": "Jordan Lee", "exclusiveAgent": false } → 200 OK { "linkId", "status": "pending", "userCreated", "reusedExistingLink" } Token Offset emails the human a one-tap approval link. The agent cannot bill the account until status is "approved". Approval links expire after 14 days; re-call signup-user to issue a new one. Step 3: Poll for approval: GET https://api.tokenoffset.com/api/agents/link-status?linkId= Authorization: Bearer → 200 OK { "linkId", "status": "pending" | "approved" | "revoked", ... } Step 4: Act on an approved account (requires status "approved"): Report conversation token usage (call after each model turn; reuse sessionId for a running log): POST https://api.tokenoffset.com/api/agents/report-usage Authorization: Bearer Content-Type: application/json { "linkId": "", "sessionId": "conv-abc123", "inputTokens": 1200, "outputTokens": 450, "cacheReadTokens": 38000, "cacheWriteTokens": 2100, "model": "claude-sonnet-4-20250514", "conversationTitle": "Offset setup for Jordan" } → 200 OK { "eventId", "sessionTotalTokens", "userTotalTokens", ... } inputTokens is uncached input. cacheReadTokens and cacheWriteTokens are optional: send them when your provider reports prompt-cache usage (Anthropic: cache_read_input_tokens, cache_creation_input_tokens; OpenAI: prompt_tokens_details.cached_tokens, subtracted from inputTokens). Pricing weights each type: output 1, input and cache writes 0.25, cache reads 0.02. Fetch running usage log: GET https://api.tokenoffset.com/api/agents/usage-log?linkId=&sessionId=conv-abc123 Authorization: Bearer Summarize usage and get a suggested monthly amount: GET https://api.tokenoffset.com/api/agents/usage-summary?linkId= Authorization: Bearer → 200 OK { "agentReportedTokens": { ..., "suggestedAmountCents" }, "providerUsage": { ..., "suggestedAmountCents" }, "activePlan" } suggestedAmountCents is the published monthly price for that usage. Pass it to set-plan as amountCents with source "usage_estimate". Set monthly offset plan from a usage band: POST https://api.tokenoffset.com/api/agents/set-plan Authorization: Bearer Content-Type: application/json { "linkId": "", "band": "worker" } Connect provider Admin API keys for usage estimates: POST https://api.tokenoffset.com/api/agents/connect-provider Authorization: Bearer Content-Type: application/json { "linkId": "", "provider": "anthropic", "apiKey": "sk-ant-admin-..." } provider is one of: anthropic (Admin key, or Claude Enterprise Analytics key), openai (sk-admin-…), cursor (team API key), openrouter (management key), xai (management key). List preset usage bands (no auth): GET https://api.tokenoffset.com/api/agents/usage-bands MCP server: https://mcp.tokenoffset.com/mcp - Send this agent key as Authorization: Bearer to_agent_... and the server lists these endpoints as tools (tokenoffset_*). - Send no key and the client signs a person in with OAuth instead; they get tools for their own account. Setup and tool reference: https://tokenoffset.com/developers - The older address https://mcp.tokenoffset.com/agent/mcp still works when you send an agent key. ## Human control - Humans always own the email on file and can sign in via magic link at https://tokenoffset.com/dashboard, even on agent-created accounts. - Humans can revoke an agent at any time from https://tokenoffset.com/dashboard/settings/agents. - Setting exclusiveAgent: true records that the agent is the only intended actor, but the human keeps recovery access.