# three.ws AI Tutor — Pay-Per-Question Coding & Learning API

> three.ws AI Tutor — Pay-Per-Question Coding & Learning API is a paid API for AI agents from three.ws, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-15).

Answers a user's educational question using an LLM, returning a structured explanation with key points, a code example, a follow-up question, and session tracking — billed $0.01 USDC per call via x402 micropayments.

## Facts

- Endpoint: POST https://three.ws/api/x402/tutor
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/three-ws-ai-tutor-pay-per-question-coding-learning-api-1c5114bf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mSWjEo_UPnuqB0buDB6PJ

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 three-ws-ai-tutor-pay-per-question-coding-learning-api-1c5114bf -d '<json body>'
```

Example prompt: Ask the three.ws tutor to explain why infinite recursion causes a stack overflow, at a beginner level — I want the key points, a corrected code example, and a follow-up question to keep learning.

## When to prefer this

Choose this endpoint when you need structured, LLM-generated educational explanations with built-in per-call micropayment billing via x402 — especially when you want session continuity, cost tracking across multiple questions, a code example, and a follow-up prompt baked into the response. Prefer this over generic LLM APIs when you need pay-as-you-go tutoring with attestation and session accounting.

## Known failure modes

- Payment not provided or insufficient — x402 Payment Required response
- Invalid or malformed session ID — session state not found
- Question field missing or empty — 400 Bad Request
- LLM backend unavailable — 503 or timeout
- Rate limit exceeded on underlying LLM provider

## How this service works

Make a 3D AI agent from a selfie in 60 seconds. Drop one HTML tag to embed it on any website. Agents think on IBM watsonx.ai (Granite); optionally charge per chat with built-in micropayments.

## Output

Returns a JSON object with: a natural-language answer, an array of key points, a working code example illustrating the concept, a suggested follow-up question, the session ID, question count, per-call cost in USDC and USD, session running total in USDC and USD, and a SHA-256 attestation hash for the response.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "level": {
   "enum": [
    "beginner",
    "intermediate",
    "expert"
   ],
   "type": "string",
   "default": "intermediate",
   "description": "Target expertise level — controls depth and assumed background."
  },
  "context": {
   "type": "string",
   "maxLength": 6000,
   "description": "Optional code or context to ground the explanation."
  },
  "question": {
   "type": "string",
   "maxLength": 2000,
   "minLength": 5,
   "description": "The question to be explained."
  },
  "sessionId": {
   "type": "string",
   "maxLength": 100,
   "description": "Stable session identifier to accumulate a running tab. Omit to start a new session."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "level": "beginner",
  "model": "llama-3.3-70b-versatile",
  "answer": "Each call to f() adds a frame to the call stack and never returns, so the stack grows until it exceeds its limit. Recursion needs a base case that stops the calls.",
  "example": "function f(n){ if (n <= 0) return 0; return n + f(n - 1); }",
  "followUp": "How would you convert this recursion into an iterative loop?",
  "keyPoints": [
   "Every function call consumes a stack frame.",
   "Recursion without a base case never unwinds.",
   "Add a condition that returns without recursing."
  ],
  "sessionId": "8f1c0c2e-2a4d-4b6e-9b1a-3c5d7e9f0a1b",
  "attestation": "sha256:abcd1234...",
  "sessionTotal": "30000",
  "questionCount": 3,
  "costThisCharge": "10000",
  "sessionTotalUsd": "0.030000",
  "costThisChargeUsd": "0.010000"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/three-ws-ai-tutor-pay-per-question-coding-learning-api-1c5114bf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from three.ws](https://www.zero.xyz/host/three.ws/llms.txt)
