# Focus & Sleep Planner – Caffeine Decay Calculator

> Focus & Sleep Planner – Caffeine Decay Calculator is a paid API for AI agents from focus-sleep-calc.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-29).

Calculates how much caffeine remains in your system after a given number of hours and when it will drop below a customizable threshold, using an adjustable half-life model.

## Facts

- Endpoint: GET https://focus-sleep-calc.x402tookit.com/caffeine-decay?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/focus-sleep-planner-caffeine-decay-calculator-385c85fc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_TejfXi0xMzUaOVcK-PCe5

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability focus-sleep-planner-caffeine-decay-calculator-385c85fc
```

Example prompt: I had a 200mg caffeine dose at 2:00 PM and I want to sleep at 10:30 PM — how much caffeine will I have left at bedtime and when will it drop below 25mg? My half-life is about 6 hours.

## When to prefer this

Use this endpoint when you need precise, parameterized caffeine decay modeling with customizable half-life and threshold values — especially when the user wants to know their personal caffeine clearance time relative to a specific bedtime or sleep goal. Prefer this over generic caffeine advice when you need structured numeric output (remaining mg, clock times, decay table) suitable for follow-on planning logic.

## Known failure modes

- Missing required doseMg parameter returns an error
- doseMg outside valid range (1–2000) may be rejected or produce unexpected results
- Invalid halfLifeHours (outside 0.5–24) may cause errors
- Malformed clock time strings for doseTime or bedtime may fail to parse
- Payment failure or insufficient USDC balance returns 402 Payment Required

## How this service works

Caffeine remaining after hours, and the time until it drops below a threshold, from a half-life you can set (default 5 hours).

## Output

Returns a JSON object with the remaining caffeine in mg at the requested time, the clock time when caffeine will drop below the threshold, a half-life table showing decay over time, optional bedtime and dose clock timestamps, a human-readable summary and verdict, and a disclaimer. If bedtime and dose time are provided, also includes the caffeine level at bedtime.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "doseMg"
     ],
     "properties": {
      "doseMg": {
       "type": "number",
       "description": "Caffeine taken, in milligrams (1 to 2000)"
      },
      "bedtime": {
       "type": "string",
       "description": "Bedtime clock time; with doseTime gives the amount left at bedtime"
      },
      "doseTime": {
       "type": "string",
       "description": "Clock time of the dose, like 2:00 PM; adds clock times to the answer"
      },
      "thresholdMg": {
       "type": "number",
       "description": "Level to fall below, in mg (default 25)"
      },
      "hoursElapsed": {
       "type": "number",
       "description": "Hours since the dose, for the remaining amount (default 0)"
      },
      "halfLifeHours": {
       "type": "number",
       "description": "Half-life in hours, 0.5 to 24 (default 5; varies a lot between people)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "doseMg": {
       "type": [
        "null",
        "number"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "remainingMg": {
       "type": [
        "null",
 
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/focus-sleep-planner-caffeine-decay-calculator-385c85fc/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from focus-sleep-calc.x402tookit.com](https://www.zero.xyz/host/focus-sleep-calc.x402tookit.com/llms.txt)
