Skip to content

feat: add API liveness check to /health endpoint #73

@nickmeinhold

Description

@nickmeinhold

Context

During the Mar 17 outage, claude-sonnet-4-6 stopped being accepted on the Max plan OAuth endpoint. The /health endpoint reported healthy the entire time because it only checks bot polling, MCP server connectivity, and OAuth token expiry — not whether the Claude API actually accepts requests.

Proposal

Add a synthetic API call to the health check — a cheap max_tokens=1 request that verifies the model is reachable:

// In health.ts, add to component checks:
try {
  await anthropic.messages.create({
    model: MODEL,
    max_tokens: 1,
    messages: [{ role: "user", content: "ping" }],
  });
  components.api = { status: "up" };
} catch (err) {
  components.api = { status: "down", error: err.message };
}

Cache the result for ~5 minutes to avoid excessive API calls on repeated health checks.

Acceptance Criteria

  • /health includes an api component with up/down status
  • API check is cached (not called on every health request)
  • Overall status degrades to degraded when API is down

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions