onWatch icon indicating copy to clipboard operation
onWatch copied to clipboard

Feature Request: Add Warp (AI terminal) provider support

Open BartNetJS opened this issue 8 months ago • 3 comments

Feature Request: Warp Provider Support

Summary

Add support for tracking AI usage quotas from Warp, the AI-powered terminal / Agentic Development Environment.

Motivation

Warp provides AI-powered features (Oz agent, AI command suggestions, etc.) and has its own usage model. Being able to track Warp AI usage alongside Anthropic, Copilot, and Codex in a single dashboard would be very useful for developers who use multiple AI tools.

What would be needed

  • Warp would need to expose a usage/quota API endpoint (similar to how Copilot and Codex do)
  • onWatch could then poll this endpoint and display usage in the dashboard

Notes

  • This may require collaboration with the Warp team to expose a queryable usage API
  • Warp's AI is powered through their own infrastructure, so the authentication mechanism would likely differ from other providers

References

  • Warp website: https://www.warp.dev/
  • Similar to how Antigravity (Windsurf) support was added

BartNetJS avatar Mar 14 '26 08:03 BartNetJS

Sure Will look into it.

prakersh avatar Mar 15 '26 18:03 prakersh

Research findings

Had a look. Warp doesn't publish a usage API, but the Warp desktop client talks to a GraphQL endpoint that exposes everything we'd need. Reverse-engineered by inspecting the client's own GraphQL traffic.

Endpoint

POST https://app.warp.dev/graphql/v2?op=GetRequestLimitInfo

Required headers

Authorization: Bearer <firebase_id_token>
x-warp-client-id: warp-app
x-warp-client-version: <client version>
x-warp-os-category: macOS | Linux | Windows
x-warp-os-name: ...
x-warp-os-version: ...
x-oz-api-source: CLOUD_MODE
Content-Type: application/json

Auth flow Same Firebase Auth pattern as our Codex provider:

  • A JSON blob containing id_token + refresh_token is persisted by the Warp desktop client
  • Exchange the refresh token for a fresh ID token via https://securetoken.googleapis.com/v1/token
  • Use the ID token as the bearer

Sample response (verified live, values masked)

{
  "data": {
    "user": {
      "__typename": "UserOutput",
      "user": {
        "workspaces": [
          {
            "uid": "<workspace-uid>",
            "bonusGrantsInfo": {
              "grants": [],
              "spendingInfo": {
                "currentMonthCreditsPurchased": 0,
                "currentMonthPeriodEnd": "<cycle-end-iso>",
                "currentMonthSpendCents": 0
              }
            }
          }
        ],
        "requestLimitInfo": {
          "isUnlimited": false,
          "nextRefreshTime": "<cycle-end-iso>",
          "requestLimit": 1500,
          "requestsUsedSinceLastRefresh": 1260,
          "requestLimitRefreshDuration": "MONTHLY",
          "isUnlimitedAutosuggestions": true,
          "acceptedAutosuggestionsLimit": 0,
          "acceptedAutosuggestionsSinceLastRefresh": 0,
          "isUnlimitedVoice": false,
          "voiceRequestLimit": 999999,
          "voiceRequestsUsedSinceLastRefresh": 0,
          "voiceTokenLimit": 10000000,
          "voiceTokensUsedSinceLastRefresh": 0,
          "isUnlimitedCodebaseIndices": false,
          "maxCodebaseIndices": 40,
          "maxFilesPerRepo": 100000,
          "embeddingGenerationBatchSize": 500
        }
      }
    }
  }
}

Notes on the shape:

  • requestLimit / requestsUsedSinceLastRefresh is the primary gauge
  • requestLimitRefreshDuration is an enum (MONTHLY etc.)
  • voiceRequestLimit: 999999 and voiceTokenLimit: 10000000 look like sentinel "effectively unlimited" values for plans where voice is bundled
  • bonusGrants[] is empty on a plain Pro account; non-empty when the user has purchased top-up credits or received promo credits
  • billingMetadata.tier.name (via the separate GetWorkspacesMetadataForUser query) gives the plan label if we want to surface "Pro / Turbo / Team / Free"

Token storage: open question

Confirmed on macOS - the refresh-token blob lives in the login Keychain at service=dev.warp.Warp-Stable, account=User (generic password, JSON body with id_token and refresh_token).

Still to figure out before implementation:

  • Windows - likely DPAPI-protected blob in %APPDATA% somewhere, or Credential Manager. Needs verification on a Windows box with Warp installed.
  • Linux - Warp on Linux typically uses libsecret (GNOME Keyring / KWallet) via Secret Service. Need to confirm the service/account names match macOS or differ.

If anyone here runs Warp on Windows or Linux and is willing to share where the token blob ends up (file path + format, or keychain service/account name), that'd unblock the cross-platform side. Otherwise I'll spin up VMs and trace it.

Proposed implementation

Mirrors the Codex provider:

  1. internal/api/warp_client.go + warp_types.go - GraphQL client
  2. internal/api/warp_oauth.go - Firebase refresh
  3. internal/api/warp_token_darwin.go / _linux.go / _windows.go - per-platform secret-store readers (Linux/Windows pending the investigation above)
  4. internal/store/warp_store.go - persist counters + cycle metadata
  5. internal/tracker/warp_tracker.go, internal/agent/warp_agent.go - poll orchestration + 401/429 refresh-retry
  6. Wire into handlers.go, dashboard JS, menubar tag
  7. docs/WARP_SETUP.md

Primary dashboard gauge: requestsUsedSinceLastRefresh / requestLimit with nextRefreshTime as the reset clock. Secondary chips for voice / codebase indices / bonus credits / monthly spend.

Caveats

  • This is the same client API the Warp desktop uses; no public SDK exists. We'd only read, never mutate.
  • If Warp changes the schema or tightens auth, we'd need to follow along - same risk profile as our other reverse-engineered providers.

Want to proceed with this design, @BartNetJS? Anything you'd want surfaced on the dashboard beyond the primary request counter?

prakersh avatar Apr 17 '26 21:04 prakersh

Parking this one for now, but recording the research so it is cheap to pick back up.

Warp open sourced the client (https://github.com/warpdotdev/warp), which answers the open question from my earlier comment. Everything is first party now:

  • Query: crates/graphql/src/api/queries/get_request_limit_info.rs
  • Full schema: crates/warp_graphql_schema/api/schema.graphql
  • URL and headers: crates/graphql/src/client.rs, crates/http_client/src/lib.rs
  • Credential blob layout: crates/warp_server_auth/src/user/persistence.rs - macOS Keychain, Linux Secret Service with an encrypted file fallback, and on Windows a DPAPI protected file rather than Credential Manager as I had guessed

There is also an API key credential type that maps to a plain bearer token on the same endpoint, so a key based version would avoid reading local secret stores entirely.

Closing on cost grounds rather than feasibility. The one thing still unverified is whether a user API key is accepted for requestLimitInfo. If someone confirms that, this becomes a small job and I am happy to reopen. PRs welcome too.

prakersh avatar Sep 20 '26 15:09 prakersh