{
  "openapi": "3.1.0",
  "info": {
    "title": "Synap402 \u2014 open-model AI, paid per call",
    "description": "OpenAI-compatible inference for agents. Pay per call in USDC on Base\u2014no account or API key. Dedicated GPUs, streaming responses, and model-level pricing. API versioning and deprecation policy: https://pool.linkrra.com/api-versioning. /v1 has no scheduled sunset; breaking versions receive migration guidance before retirement.",
    "version": "1.0.0",
    "contact": {
      "email": "weare@linkrra.com",
      "name": "Linkrra"
    },
    "x-guidance": "# Linkrra Pearl Pool and Synap402 API documentation\n\n## Discover\nThe inference base URL is https://pool.linkrra.com/v1. Read [OpenAPI](/openapi.json) before calling write operations. [Pool API metadata](/api/openapi.json) describes mining endpoints separately. [MCP setup](/mcp-guide.md) provides the same inference discovery and chat capabilities through tools.\n\n## Authentication\nPublic model discovery and the three read-only MCP tools require no credentials. For billed inference, sign in at https://synap402.com and create an API key in your account. Send it as `Authorization: Bearer YOUR_API_KEY`. Never place keys in URLs, public code, or tool arguments. See [authentication](/auth.md).\n\n## List models without spending\n```sh\ncurl https://pool.linkrra.com/v1/models\n```\nThe JSON object contains a `data` array. Use a returned model `id`; inspect its current pricing and capabilities. This endpoint is read-only and returns the current catalogue in one response; no pagination is required.\n\n## Run a completion\n```sh\ncurl https://pool.linkrra.com/v1/chat/completions \\\n  -H 'Content-Type: application/json' \\\n  -H 'Authorization: Bearer YOUR_API_KEY' \\\n  -d '{\"model\":\"MODEL_ID_FROM_CATALOGUE\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}],\"max_tokens\":256}'\n```\nSuccessful non-streaming responses contain `choices` and `usage`. Setting `stream:true` requests OpenAI-compatible server-sent events. This is a synchronous streaming operation, not an asynchronous job queue.\n\n## Pay per request\nAgents with a supported wallet can use the [x402 discovery document](/.well-known/x402). An unpaid request returns a payment challenge; inspect that exact quote and supported network before authorizing payment. Do not automatically pay, retry a charged operation or assume the same quote remains valid indefinitely.\n\n## Errors and retries\nInspect the HTTP status and JSON error. A missing/invalid key requires authentication; a payment challenge requires explicit funding; an unavailable service should be retried with backoff. Respect `Retry-After` when supplied. Never blindly retry non-idempotent paid calls after an ambiguous disconnect; a timeout does not prove the call was not processed. No general Idempotency-Key guarantee is advertised.\n\n## Versioning and deprecation\nThe OpenAI-compatible interface uses `/v1`. Additive fields may be introduced; clients should ignore unknown fields. Breaking revisions are published under a new version with migration guidance before the old version is retired. No end-of-life date for `/v1` is currently scheduled. Model availability is dynamic: refresh `/v1/models` instead of hardcoding a catalogue.\n\n## Safe integration checks\nUse the public catalogue and free MCP tools to test connectivity without a payment or side effect. There is no separate production-equivalent sandbox. Never interpret these read-only checks as proof that a paid completion or payout succeeded.\n\n## Safe integration testing\n\nThe [API sandbox](/sandbox.md) uses the separate `/sandbox/v1` base URL and the synthetic model `pool-sandbox-synthetic`. It cannot reach models, accounts or billing. JSON and SSE responses let you test a client without production calls; it is not a model-quality or payment test.\n\n## Search this documentation\n\nUse `GET /ask?query=API%20keys` or NLWeb v0.55 `POST /ask` with `{\"query\":{\"text\":\"API keys\"},\"prefer\":{\"mode\":\"list\",\"response_format\":\"conversational_search\",\"streaming\":false},\"meta\":{\"version\":\"0.55\"}}`. This returns `_meta` and ranked excerpts from public documentation, not generated advice. Set `prefer.streaming: true` for standard SSE `start`, `result`, `error` and `complete` framing. Only list/retrieval mode is supported. The separate documentation MCP server is at `/docs/mcp`.\n\n## Asynchronous batch jobs and safe retries\n\nThe production Batch API requires a private API key. Upload a JSONL input with `POST /v1/files` using multipart fields `file` and `purpose=batch`, then submit `POST /v1/batches` with `input_file_id`, `endpoint: \"/v1/chat/completions\"`, `completion_window: \"24h\"`, and optional metadata (up to 16 string pairs). Creating a batch authorizes inference and can incur charges; the synthetic sandbox does not run batches.\n\nJob creation returns HTTP 200 by default for OpenAI SDK compatibility. To use HTTP asynchronous semantics, send `Prefer: respond-async`: the server returns HTTP 202 with `Preference-Applied: respond-async`. Both responses include `Location: /v1/batches/<id>` and a job identifier/status in the body. Replays honor the current preference without creating another job. Poll `GET /v1/batches/<id>`, retrieve result content using `GET /v1/files/<id>/content`, and cancel remaining work with `POST /v1/batches/<id>/cancel`. Cancelling does not undo completed work or settled charges.\n\nFor `POST /v1/batches` only, send `Idempotency-Key` with 1\u2013128 visible ASCII characters. Identical canonical parameters under the same API key return the same durable job; `Idempotency-Replayed: true` identifies a replay. Reusing the key with changed parameters returns HTTP 409 `idempotency_conflict`. The deduplication record survives process restart and is isolated per API key, not across all keys of an account. Invalid keys return HTTP 400 `invalid_idempotency_key`. Calls without this header retain ordinary create behavior.\n\nThis guarantee does not apply to streaming inference, swaps, file upload or arbitrary POST routes. After an ambiguous paid-inference timeout, inspect state rather than retrying a chargeable request blindly.\n",
    "x-deprecation-policy": "The /v1 interface is versioned. Additive fields may appear; breaking revisions use a new version with migration guidance before retirement. No /v1 sunset date is scheduled. Refresh /v1/models for current availability."
  },
  "servers": [
    {
      "url": "https://pool.linkrra.com"
    }
  ],
  "x-discovery": {
    "ownershipProofs": [
      "0xa9cc92d7aa63ba465e55198553ddc54ffb34f61ce5d00e2aa8f0dcc24695598632238b7b8e16ee914f2aa53677c75a1a8b53a5e24e02b4d2d33fd363890e35b61b",
      "0x4861df6f03de83d6c9d0799a4f9dbdcefb70fad00c0a9c751ebb753025d7336d100110bcf13e23c700b74cb73be87c5adfac933e43c8fae6a53bc4acba0c932f1c",
      "0x3f7be7eed22ee90a86ddf764f102a0bbe2df56de0deb425c8d219994c31dd8be736210646bd2b01fac74609c8fa5a959489576d275a0284d9c279cfd8c2e02aa1b",
      "565RAxgonF15YBaHTVUhLyrBGySpLNbwCLZLhYc166QxUZeL6vp6V6EtBchR1RNB9oKrQfPcHrw2smtMrtQaEvpq",
      "2mrP7eGJxXxyJWeekexpNdDoyGd7tjyBDdEt3xebbkij6tFEpojeJnoLhRNVQ2X11BX4dRiJ9NPjJDCYqXRMwXad",
      "2FVteGGnUNxrbYEke8DZYcedvoZ6F3W7LnpK6J47BC6jxPUcRj3qfJj9U1Ve7AJA3VYs4KgWBK2YVD8HwwKDirhh"
    ],
    "contactEmail": "michael@linkrra.com",
    "contactNote": "directories/programmes: michael@linkrra.com; API customers: info.contact.email"
  },
  "paths": {
    "/v1/models": {
      "get": {
        "operationId": "listModels",
        "summary": "Model catalogue with per-model USD prices per million tokens. Free.",
        "responses": {
          "200": {
            "description": "OpenAI-style model list with pricing metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "id"
                        ],
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "pricing": {
                            "type": "object",
                            "properties": {
                              "prompt_per_million": {
                                "type": "number"
                              },
                              "completion_per_million": {
                                "type": "number"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/billing/x402/chat/completions": {
      "post": {
        "operationId": "payPerCallChatCompletion",
        "summary": "LLM chat completions: OpenAI-compatible inference API (gpt-oss-20b, Gemma 4 26B, Qwen3 30B, Qwen3 Coder 30B, Qwen3 VL 30B). Pay per call in USDC on Base via x402, no account, no API key. From $0.001 per call.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "\"auto\" (cheapest fit) or a concrete model id from GET /v1/models"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Capped at 4096 (billing/x402-inference.js DEFAULT_MAX_OUTPUT_TOKENS); ask for less and the quote is priced for less"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage and payment receipt (tx hash).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact request."
          }
        },
        "description": "Cheap LLM inference for agent loops: one OpenAI-compatible chat completion per paid call. Send model \"auto\" (cheapest fit) or a model id from GET /v1/models. Price is quoted for this exact request: minimum $0.001, usage-priced per token above that. Streaming supported. Unknown model names get a 402 carrying suggested_model with its own accepts[] (suggestion only, never substituted).",
        "tags": [
          "llm",
          "inference",
          "chat-completions"
        ]
      }
    },
    "/api/billing/x402/topup": {
      "post": {
        "operationId": "x402CreditTopup",
        "summary": "Buy prepaid inference credits with one x402 payment; the paying wallet is the account. Minimum top-up $1.00 (max $1000); below $1 is rejected.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "1.00",
            "max": "1000.00"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "amountUsd"
                ],
                "properties": {
                  "amountUsd": {
                    "type": "number",
                    "minimum": 1,
                    "maximum": 1000
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Credits added; balance and tx hash returned."
          },
          "402": {
            "description": "x402 v2 PaymentRequired challenge."
          }
        }
      }
    },
    "/api/billing/x402/tts": {
      "post": {
        "operationId": "payPerCallTts",
        "summary": "Text-to-speech WAV clip, paid per call with x402 (USDC on Base). Hebrew gets automatic nikud. Minimum charge $0.01 per call; character-based price above it.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.01",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 4000
                  },
                  "sampleRate": {
                    "type": "number"
                  },
                  "nikud": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "audio/wav bytes."
          },
          "402": {
            "description": "x402 v2 PaymentRequired challenge priced for this text."
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "chatCompletionApiKey",
        "summary": "OpenAI-compatible chat completion \u2014 pay per call in USDC with x402 and no key, or bill an API key's credit balance.",
        "description": "Two ways in, one URL. With `Authorization: Bearer <SYNAP_API_KEY>` the call debits that key's credit ledger (fund it via POST /api/billing/x402/topup; the free tier needs a key too). With NO Authorization header at all the call answers HTTP 402 with x402 v2 payment requirements (base64 in the PAYMENT-REQUIRED header, the same JSON in the body) and serves the completion when repeated with a PAYMENT-SIGNATURE header. Keyless minimum charge $0.001 per call; a key is debited for the tokens used. A wrong or expired key is an authentication error, not a price.",
        "security": [
          {
            "bearerAuth": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "model",
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "A concrete model id from GET /v1/models"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number"
                  },
                  "temperature": {
                    "type": "number"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage; balance debited from the API key credit ledger.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "An Authorization header was sent and it is not a valid Synap key."
          },
          "402": {
            "description": "x402 v2 PaymentRequired (keyless caller): pay it and repeat the request."
          }
        },
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          },
          "keyless": true,
          "canonicalResource": "https://pool.linkrra.com/api/billing/x402/chat/completions",
          "note": "Send no Authorization header and this URL answers the x402 402 challenge and accepts the payment in place (one resource identity: the challenge names canonicalResource). Send Authorization: Bearer <key> and it debits that key's credit balance instead."
        }
      }
    },
    "/.well-known/x402": {
      "get": {
        "operationId": "x402Discovery",
        "summary": "x402 discovery document: every paid resource with the live payment requirements its own door quotes. Also served at /.well-known/x402.json.",
        "security": [],
        "responses": {
          "200": {
            "description": "application/json",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "x402Version": {
                      "type": "integer"
                    },
                    "serviceName": {
                      "type": "string"
                    },
                    "resources": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "format": "uri"
                      }
                    },
                    "endpoints": {
                      "type": [
                        "object",
                        "array"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/x402/discovery/resources": {
      "get": {
        "operationId": "x402BazaarList",
        "summary": "x402 Bazaar discovery list (specs/x402-specification-v2 \u00a78.1 shape). Also at /.well-known/x402/discovery/resources.",
        "security": [],
        "responses": {
          "200": {
            "description": "application/json",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "pagination"
                  ],
                  "properties": {
                    "x402Version": {
                      "type": "integer"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "resource": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "accepts": {
                            "type": "array",
                            "items": {
                              "type": "object"
                            }
                          }
                        }
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "required": [
                        "limit",
                        "offset",
                        "total"
                      ],
                      "properties": {
                        "limit": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "offset": {
                          "type": "integer",
                          "minimum": 0
                        },
                        "total": {
                          "type": "integer",
                          "minimum": 0
                        }
                      }
                    },
                    "source": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Maximum entries returned."
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0
            },
            "description": "Number of entries skipped; continue until offset plus returned items reaches total."
          }
        ]
      }
    },
    "/api/billing/x402/models/qwen3-vl-30b-a3b-instruct/chat/completions": {
      "post": {
        "operationId": "payPerCall_qwen3_vl_30b_a3b_instruct",
        "summary": "LLM chat completions on Qwen3 VL 30B A3B Instruct (vision, 64K context). OpenAI-compatible, pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Optional; this door serves \"qwen/qwen3-vl-30b-a3b-instruct\" only"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Capped at 4096 (billing/x402-inference.js DEFAULT_MAX_OUTPUT_TOKENS); ask for less and the quote is priced for less"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage and payment receipt (tx hash).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact request."
          }
        },
        "description": "One OpenAI-compatible chat completion on model \"qwen/qwen3-vl-30b-a3b-instruct\" only; the model field may be omitted. Price is quoted for this exact request: minimum $0.001, usage-priced per token above that (GET /v1/models). Streaming supported.",
        "tags": [
          "llm",
          "inference",
          "chat-completions"
        ]
      }
    },
    "/api/billing/x402/models/qwen3-coder-30b/chat/completions": {
      "post": {
        "operationId": "payPerCall_qwen3_coder_30b",
        "summary": "LLM chat completions on Qwen3 Coder 30B A3B Instruct (coding, everyday, 96K context). OpenAI-compatible, pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Optional; this door serves \"qwen3-coder-30b\" only"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Capped at 4096 (billing/x402-inference.js DEFAULT_MAX_OUTPUT_TOKENS); ask for less and the quote is priced for less"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage and payment receipt (tx hash).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact request."
          }
        },
        "description": "One OpenAI-compatible chat completion on model \"qwen3-coder-30b\" only; the model field may be omitted. Price is quoted for this exact request: minimum $0.001, usage-priced per token above that (GET /v1/models). Streaming supported.",
        "tags": [
          "llm",
          "inference",
          "chat-completions"
        ]
      }
    },
    "/api/billing/x402/models/gpt-oss-20b/chat/completions": {
      "post": {
        "operationId": "payPerCall_gpt_oss_20b",
        "summary": "LLM chat completions on OpenAI gpt-oss-20b (fast + cheap general model, 64K context). OpenAI-compatible, pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Optional; this door serves \"gpt-oss-20b\" only"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Capped at 4096 (billing/x402-inference.js DEFAULT_MAX_OUTPUT_TOKENS); ask for less and the quote is priced for less"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage and payment receipt (tx hash).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact request."
          }
        },
        "description": "One OpenAI-compatible chat completion on model \"gpt-oss-20b\" only; the model field may be omitted. Price is quoted for this exact request: minimum $0.001, usage-priced per token above that (GET /v1/models). Streaming supported.",
        "tags": [
          "llm",
          "inference",
          "chat-completions"
        ]
      }
    },
    "/api/billing/x402/models/muse-glimmer-30b/chat/completions": {
      "post": {
        "operationId": "payPerCall_muse_glimmer_30b",
        "summary": "LLM chat completions on Meta Muse Glimmer 30B (agentic reasoning + tool use (text), 128K context). OpenAI-compatible, pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Optional; this door serves \"meta/muse-glimmer-30b\" only"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Capped at 4096 (billing/x402-inference.js DEFAULT_MAX_OUTPUT_TOKENS); ask for less and the quote is priced for less"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage and payment receipt (tx hash).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact request."
          }
        },
        "description": "One OpenAI-compatible chat completion on model \"meta/muse-glimmer-30b\" only; the model field may be omitted. Price is quoted for this exact request: minimum $0.001, usage-priced per token above that (GET /v1/models). Streaming supported.",
        "tags": [
          "llm",
          "inference",
          "chat-completions"
        ]
      }
    },
    "/api/billing/x402/models/qwen3.8-27b-abliterated/chat/completions": {
      "post": {
        "operationId": "payPerCall_qwen3_8_27b_abliterated",
        "summary": "LLM chat completions on Huihui Qwen3.8 27B (Uncensored) (vision, 16K context). OpenAI-compatible, pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "model": {
                    "type": "string",
                    "description": "Optional; this door serves \"huihui-ai/qwen3.8-27b-abliterated\" only"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "max_tokens": {
                    "type": "number",
                    "description": "Capped at 4096 (billing/x402-inference.js DEFAULT_MAX_OUTPUT_TOKENS); ask for less and the quote is priced for less"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion object with usage and payment receipt (tx hash).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "choices"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "tool_calls": {
                                "type": "array",
                                "items": {
                                  "type": "object"
                                }
                              }
                            }
                          },
                          "finish_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact request."
          }
        },
        "description": "One OpenAI-compatible chat completion on model \"huihui-ai/qwen3.8-27b-abliterated\" only; the model field may be omitted. Price is quoted for this exact request: minimum $0.001, usage-priced per token above that (GET /v1/models). Streaming supported.",
        "tags": [
          "llm",
          "inference",
          "chat-completions"
        ]
      }
    },
    "/api/billing/x402/tasks/extract-json": {
      "post": {
        "operationId": "payPerCallExtractJson",
        "summary": "Extract structured JSON from text that validates against your JSON Schema (server-side validation, one repair retry). Pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "description": "Synap402 - JSON extraction: send text and a JSON Schema, get data validated against that schema server-side (one automatic repair retry). Output still invalid = 422 and nothing is charged. Open models on dedicated GPUs. Pay per call in USDC on any network in the payment challenge; no account, no API key.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text",
                  "schema"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "Source text to extract from (untrusted data)."
                  },
                  "schema": {
                    "type": "object",
                    "description": "JSON Schema the result must validate against (<= 16 KB, local $ref only)."
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Optional extra guidance."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2048,
                    "default": 768,
                    "description": "Output cap; raise for large records."
                  }
                }
              },
              "example": {
                "text": "Invoice INV-2041 from Acme Corp, total $1,250.00, due 2026-12-01.",
                "schema": {
                  "type": "object",
                  "required": [
                    "invoice_number",
                    "vendor",
                    "total"
                  ],
                  "properties": {
                    "invoice_number": {
                      "type": "string"
                    },
                    "vendor": {
                      "type": "string"
                    },
                    "total": {
                      "type": "number"
                    },
                    "due_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "model",
                    "usage"
                  ],
                  "properties": {
                    "data": {
                      "description": "The extracted value, valid against the schema you sent."
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "data": {
                    "invoice_number": "INV-2041",
                    "vendor": "Acme Corp",
                    "total": 1250,
                    "due_date": "2026-12-01"
                  },
                  "model": "qwen3-coder-30b",
                  "usage": {
                    "prompt_tokens": 210,
                    "completion_tokens": 38,
                    "total_tokens": 248
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "422": {
            "description": "The output did not validate against your schema after one repair retry; error.errors lists why. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "extract-json"
        ]
      }
    },
    "/api/billing/x402/tasks/summarize-url": {
      "post": {
        "operationId": "payPerCallSummarizeUrl",
        "summary": "Summarize a web page: send a URL, we fetch it server-side and return a faithful summary and the page title. Pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "description": "Synap402 - summarize a web page: send a URL, we fetch it server-side (public http/https, HTML or plain text, 2 MB, 10 s) and return a faithful summary plus the page title. Fetch fails = no charge. Open models on dedicated GPUs. Pay per call in USDC on any network in the payment challenge; no account, no API key.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public http(s) URL, ports 80/443. Page text is treated as data."
                  },
                  "max_words": {
                    "type": "integer",
                    "minimum": 20,
                    "maximum": 1000,
                    "default": 200,
                    "description": "Summary length cap."
                  },
                  "focus": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Optional: what to focus on."
                  }
                }
              },
              "example": {
                "url": "https://example.com",
                "max_words": 120
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "summary",
                    "title",
                    "url",
                    "model",
                    "usage"
                  ],
                  "properties": {
                    "summary": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "The URL summarised, after redirects."
                    },
                    "truncated": {
                      "type": "boolean",
                      "description": "true when only the first part of a long page was summarised."
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "summary": "A placeholder page reserved for documentation examples. - The domain may be used in docs without permission.",
                  "title": "Example Domain",
                  "url": "https://example.com/",
                  "truncated": false,
                  "model": "gemma-4-26b-a4b-it",
                  "usage": {
                    "prompt_tokens": 160,
                    "completion_tokens": 45,
                    "total_tokens": 205
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "415": {
            "description": "The URL did not return HTML or plain text. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "422": {
            "description": "The page has no readable text. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "502": {
            "description": "The page could not be fetched (or the model failed). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "summarize-url"
        ]
      }
    },
    "/api/billing/x402/tasks/review-code": {
      "post": {
        "operationId": "payPerCallReviewCode",
        "summary": "Code review of a unified diff or source code: a summary plus JSON issues with severity, file, line, message and suggested fix. Pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "description": "Synap402 - code review: send a unified diff or source code, get a summary and a JSON list of issues (severity, file, line, message, suggestion) - bugs, security, edge cases, no style nits. Invalid model output = no charge. Open models on dedicated GPUs. Pay per call in USDC on any network in the payment challenge; no account, no API key.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "diff": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "A unified diff (send diff OR code)."
                  },
                  "code": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "Source code (send diff OR code)."
                  },
                  "language": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "focus": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Optional: e.g. \"security\"."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2048,
                    "default": 1536
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "diff"
                    ]
                  },
                  {
                    "required": [
                      "code"
                    ]
                  }
                ]
              },
              "example": {
                "diff": "--- a/app.py\n+++ b/app.py\n@@ -1,2 +1,2 @@\n def get_user(db, uid):\n-    return db.query(\"SELECT * FROM users WHERE id = %s\", (uid,))\n+    return db.query(f\"SELECT * FROM users WHERE id = {uid}\")\n",
                "language": "python",
                "max_tokens": 512
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "summary",
                    "issues",
                    "model",
                    "usage"
                  ],
                  "properties": {
                    "summary": {
                      "type": "string"
                    },
                    "issues": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "severity",
                          "message"
                        ],
                        "properties": {
                          "severity": {
                            "type": "string",
                            "enum": [
                              "critical",
                              "high",
                              "medium",
                              "low",
                              "info"
                            ]
                          },
                          "file": {
                            "type": "string"
                          },
                          "line": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          },
                          "suggestion": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "summary": "Replaces a parameterised query with an f-string: SQL injection. Request changes.",
                  "issues": [
                    {
                      "severity": "critical",
                      "file": "app.py",
                      "line": 2,
                      "message": "uid is interpolated into SQL: injection.",
                      "suggestion": "Keep the parameterised query: db.query(\"... WHERE id = %s\", (uid,))."
                    }
                  ],
                  "model": "qwen3-coder-30b",
                  "usage": {
                    "prompt_tokens": 260,
                    "completion_tokens": 90,
                    "total_tokens": 350
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "502": {
            "description": "The model did not return a well-formed review after one repair retry. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "review-code"
        ]
      }
    },
    "/api/billing/x402/tasks/describe-image": {
      "post": {
        "operationId": "payPerCallDescribeImage",
        "summary": "Describe an image (vision, OCR of visible text): send image_url or image_base64 and an optional question. Qwen3-VL. Pay per call in USDC via x402, no account, no API key. From $0.001 per call.",
        "description": "Synap402 - describe an image: send image_url (fetched server-side, public URLs only) or image_base64 (PNG, JPEG, GIF, WebP, 4 MB) and an optional question; get a precise description with visible text transcribed. Qwen3-VL on dedicated GPUs. Fetch fails = no charge. Pay per call in USDC; no account, no API key.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public http(s) image URL (send image_url OR image_base64)."
                  },
                  "image_base64": {
                    "type": "string",
                    "description": "Raw base64 or data:image/...;base64,... (PNG/JPEG/GIF/WebP, 4 MB)."
                  },
                  "question": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Optional: what to look for."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1024,
                    "default": 768
                  }
                },
                "anyOf": [
                  {
                    "required": [
                      "image_url"
                    ]
                  },
                  {
                    "required": [
                      "image_base64"
                    ]
                  }
                ]
              },
              "example": {
                "image_url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
                "question": "What is in this image?"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "description",
                    "model",
                    "usage"
                  ],
                  "properties": {
                    "description": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "description": "Two dice rendered in 3D on a checkerboard background showing transparency...",
                  "model": "qwen/qwen3-vl-30b-a3b-instruct",
                  "usage": {
                    "prompt_tokens": 1210,
                    "completion_tokens": 60,
                    "total_tokens": 1270
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "415": {
            "description": "Not a PNG, JPEG, GIF or WebP image. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "502": {
            "description": "The image could not be fetched (or the model failed). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "describe-image"
        ]
      }
    },
    "/api/billing/x402/tasks/code-patch": {
      "post": {
        "operationId": "payPerCallCodePatch",
        "summary": "Create a bounded code patch: send a change request and source files, receive a validated unified diff, explanation, and tests. Pay per call in USDC via x402.",
        "description": "Synap402 - code patch: send a bounded change request and the source files it may edit; get a server-validated JSON result containing a unified diff, explanation, and tests. The patch may name only supplied files. Invalid model output = no charge. Pay per call in USDC via x402; no account or API key.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "request",
                  "files"
                ],
                "properties": {
                  "request": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4000,
                    "description": "The exact change to make."
                  },
                  "files": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 20,
                    "items": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "path",
                        "content"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 300
                        },
                        "content": {
                          "type": "string",
                          "maxLength": 100000
                        }
                      }
                    }
                  },
                  "language": {
                    "type": "string",
                    "maxLength": 40
                  },
                  "test_command": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2048,
                    "default": 1536
                  }
                }
              },
              "example": {
                "request": "Return HTTP 400 when name is blank.",
                "language": "javascript",
                "files": [
                  {
                    "path": "src/handler.js",
                    "content": "export function handler(name) { return { status: 200, body: name }; }\n"
                  }
                ],
                "test_command": "npm test",
                "max_tokens": 1024
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "patch",
                    "explanation",
                    "tests",
                    "model",
                    "usage",
                    "payment"
                  ],
                  "properties": {
                    "patch": {
                      "type": "string",
                      "description": "Unified diff naming only files supplied in the request."
                    },
                    "explanation": {
                      "type": "string"
                    },
                    "tests": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "patch": "--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1 +1,4 @@\n-export function handler(name) { return { status: 200, body: name }; }\n+export function handler(name) {\n+  if (!name || !name.trim()) return { status: 400, body: \"name is required\" };\n+  return { status: 200, body: name };\n+}\n",
                  "explanation": "Rejects missing or whitespace-only names before producing the success response.",
                  "tests": [
                    "npm test",
                    "Add cases for an empty string and whitespace-only input."
                  ],
                  "model": "qwen3-coder-30b",
                  "usage": {
                    "prompt_tokens": 190,
                    "completion_tokens": 130,
                    "total_tokens": 320,
                    "calls": 1
                  },
                  "payment": {
                    "paidUsd": 0.001,
                    "quotedUsd": 0.001,
                    "transaction": "0xexample",
                    "network": "eip155:8453",
                    "payerAddress": "0x0000000000000000000000000000000000000000"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "422": {
            "description": "The generated patch did not pass the strict output contract after one repair retry. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "code-patch"
        ]
      }
    },
    "/api/billing/x402/tasks/structured-extraction": {
      "post": {
        "operationId": "payPerCallStructuredExtraction",
        "summary": "Extract structured data from text under a caller-supplied JSON Schema, with server-side validation. Pay per call in USDC via x402.",
        "description": "Synap402 - structured extraction: send source text and a strict JSON Schema; get data validated against that schema server-side. The request contract rejects unknown fields, and invalid model output is repaired once or returned uncharged. Pay per call in USDC via x402; no account or API key.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "text",
                  "schema"
                ],
                "properties": {
                  "text": {
                    "type": "string",
                    "maxLength": 100000,
                    "description": "Source text to extract from (untrusted data)."
                  },
                  "schema": {
                    "type": "object",
                    "description": "JSON Schema the result must validate against (<= 16 KB, local $ref only)."
                  },
                  "instructions": {
                    "type": "string",
                    "maxLength": 2000,
                    "description": "Optional extra guidance."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 2048,
                    "default": 768,
                    "description": "Output cap; raise for large records."
                  }
                },
                "additionalProperties": false
              },
              "example": {
                "text": "Invoice INV-2041 from Acme Corp, total $1,250.00, due 2026-12-01.",
                "schema": {
                  "type": "object",
                  "required": [
                    "invoice_number",
                    "vendor",
                    "total"
                  ],
                  "properties": {
                    "invoice_number": {
                      "type": "string"
                    },
                    "vendor": {
                      "type": "string"
                    },
                    "total": {
                      "type": "number"
                    },
                    "due_date": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "data",
                    "model",
                    "usage",
                    "payment"
                  ],
                  "properties": {
                    "data": {
                      "description": "The extracted value, valid against the schema sent in the request."
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "data": {
                    "invoice_number": "INV-2041",
                    "vendor": "Acme Corp",
                    "total": 1250,
                    "due_date": "2026-12-01"
                  },
                  "model": "qwen3-coder-30b",
                  "usage": {
                    "prompt_tokens": 210,
                    "completion_tokens": 38,
                    "total_tokens": 248,
                    "calls": 1
                  },
                  "payment": {
                    "paidUsd": 0.001,
                    "quotedUsd": 0.001,
                    "transaction": "0xexample",
                    "network": "eip155:8453",
                    "payerAddress": "0x0000000000000000000000000000000000000000"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "422": {
            "description": "The output did not validate against the supplied schema after one repair retry. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "structured-extraction"
        ]
      }
    },
    "/api/billing/x402/tasks/vision-inspection": {
      "post": {
        "operationId": "payPerCallVisionInspection",
        "summary": "Inspect an image and receive schema-validated objects, visible text, summary, and assessment. Pay per call in USDC via x402.",
        "description": "Synap402 - vision inspection: send a public image URL or base64 image and receive server-validated JSON with summary, objects, visible text, and a quality/category assessment. Unknown input fields and malformed model output are rejected; task failure is not charged. Pay per call in USDC via x402.",
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.001",
            "max": "0.05"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "image_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Public http(s) image URL (send image_url OR image_base64)."
                  },
                  "image_base64": {
                    "type": "string",
                    "description": "Raw base64 or data:image/...;base64,... (PNG/JPEG/GIF/WebP, 4 MB)."
                  },
                  "question": {
                    "type": "string",
                    "maxLength": 1000,
                    "description": "Optional: what to look for."
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1024,
                    "default": 768
                  }
                },
                "additionalProperties": false,
                "anyOf": [
                  {
                    "required": [
                      "image_url"
                    ]
                  },
                  {
                    "required": [
                      "image_base64"
                    ]
                  }
                ]
              },
              "example": {
                "image_url": "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png",
                "question": "Inspect the objects and visible text.",
                "max_tokens": 1024
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The task result, with usage and the payment receipt (PAYMENT-RESPONSE header).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "summary",
                    "objects",
                    "visible_text",
                    "assessment",
                    "model",
                    "usage",
                    "payment"
                  ],
                  "properties": {
                    "summary": {
                      "type": "string"
                    },
                    "objects": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "label",
                          "details"
                        ],
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "details": {
                            "type": "string"
                          },
                          "location": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        }
                      }
                    },
                    "visible_text": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "assessment": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "category",
                        "quality",
                        "warnings"
                      ],
                      "properties": {
                        "category": {
                          "type": "string",
                          "enum": [
                            "photo",
                            "screenshot",
                            "document",
                            "diagram",
                            "chart",
                            "other"
                          ]
                        },
                        "quality": {
                          "type": "string",
                          "enum": [
                            "clear",
                            "partly_clear",
                            "poor"
                          ]
                        },
                        "warnings": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "model": {
                      "type": "string"
                    },
                    "usage": {
                      "$ref": "#/components/schemas/TaskUsage"
                    },
                    "payment": {
                      "$ref": "#/components/schemas/TaskPayment"
                    }
                  }
                },
                "example": {
                  "summary": "Two rendered dice appear on a checkerboard transparency background.",
                  "objects": [
                    {
                      "label": "die",
                      "details": "A red translucent six-sided die.",
                      "location": "left"
                    },
                    {
                      "label": "die",
                      "details": "A white six-sided die.",
                      "location": "right"
                    }
                  ],
                  "visible_text": [],
                  "assessment": {
                    "category": "other",
                    "quality": "clear",
                    "warnings": []
                  },
                  "model": "qwen/qwen3-vl-30b-a3b-instruct",
                  "usage": {
                    "prompt_tokens": 1210,
                    "completion_tokens": 120,
                    "total_tokens": 1330,
                    "calls": 1
                  },
                  "payment": {
                    "paidUsd": 0.001,
                    "quotedUsd": 0.001,
                    "transaction": "0xexample",
                    "network": "eip155:8453",
                    "payerAddress": "0x0000000000000000000000000000000000000000"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input (including a URL that is not a public http/https address). Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "402": {
            "description": "x402 v2 PaymentRequired: base64 in the PAYMENT-REQUIRED header and the same JSON in the body, priced for this exact input."
          },
          "409": {
            "description": "This payment authorization was already used (or is in use by a request in progress).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "413": {
            "description": "Input too large, or the quote would exceed the per-call ceiling. Refused before payment.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "415": {
            "description": "Not a PNG, JPEG, GIF or WebP image. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "422": {
            "description": "The generated inspection did not pass the strict output contract after one repair retry. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "502": {
            "description": "The image could not be fetched (or the model failed). Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          },
          "503": {
            "description": "No node is serving this task right now. Nothing was charged.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskError"
                }
              }
            }
          }
        },
        "tags": [
          "llm",
          "tasks",
          "vision-inspection"
        ]
      }
    },
    "/v1/batches": {
      "post": {
        "operationId": "createBatch",
        "summary": "Create an asynchronous inference batch (chargeable)",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Batch creation only. Same key and canonical parameters under the SAME API key replay the original job. Changed parameters return 409. Durable across restart; no promise for other POST routes.",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[!-~]+$"
            }
          },
          {
            "name": "Prefer",
            "in": "header",
            "required": false,
            "description": "Send respond-async for 202 Accepted and Preference-Applied. Default stays200. Applies to new jobs and idempotent replays.",
            "schema": {
              "type": "string",
              "example": "respond-async"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "input_file_id": {
                    "type": "string"
                  },
                  "endpoint": {
                    "const": "/v1/chat/completions"
                  },
                  "completion_window": {
                    "const": "24h"
                  },
                  "metadata": {
                    "type": "object",
                    "maxProperties": 16,
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "input_file_id",
                  "endpoint",
                  "completion_window"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Job accepted or replayed. Poll the Location URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "const": "batch"
                    },
                    "status": {
                      "type": "string"
                    },
                    "input_file_id": {
                      "type": "string"
                    },
                    "output_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "error_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "request_counts": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "status"
                  ]
                }
              }
            },
            "headers": {
              "Location": {
                "description": "Relative URL for polling the created or replayed job",
                "schema": {
                  "type": "string"
                }
              },
              "Idempotency-Replayed": {
                "description": "Present when Idempotency-Key supplied: true on replay, false on original creation",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or idempotency key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Authentication required",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "409": {
            "description": "Idempotency key reused with different parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Asynchronous job accepted or replayed when Prefer: respond-async. Poll Location using returned job id.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "const": "batch"
                    },
                    "status": {
                      "type": "string"
                    },
                    "input_file_id": {
                      "type": "string"
                    },
                    "output_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "error_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "request_counts": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "status"
                  ]
                }
              }
            },
            "headers": {
              "Location": {
                "description": "Relative URL for polling the created or replayed job",
                "schema": {
                  "type": "string"
                }
              },
              "Idempotency-Replayed": {
                "description": "Present when Idempotency-Key supplied: true on replay, false on original creation",
                "schema": {
                  "type": "string",
                  "enum": [
                    "true",
                    "false"
                  ]
                }
              },
              "Preference-Applied": {
                "schema": {
                  "const": "respond-async"
                },
                "description": "Acknowledges async response preference"
              }
            }
          }
        }
      }
    },
    "/v1/batches/{batch_id}": {
      "get": {
        "operationId": "getBatch",
        "summary": "Poll asynchronous batch status",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current tenant-owned batch state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "const": "batch"
                    },
                    "status": {
                      "type": "string"
                    },
                    "input_file_id": {
                      "type": "string"
                    },
                    "output_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "error_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "request_counts": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inaccessible batch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/batches/{batch_id}/cancel": {
      "post": {
        "operationId": "cancelBatch",
        "summary": "Cancel unprocessed batch work; completed charges are not reversed",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "batch_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancellation state",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "const": "batch"
                    },
                    "status": {
                      "type": "string"
                    },
                    "input_file_id": {
                      "type": "string"
                    },
                    "output_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "error_file_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "request_counts": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "status"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Unknown or inaccessible batch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/ask": {
      "get": {
        "operationId": "searchPublicDocsGet",
        "summary": "Retrieve public documentation excerpts, not generated answers",
        "security": [],
        "responses": {
          "200": {
            "description": "Ranked retrieval results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query_id": {
                      "type": "string"
                    },
                    "query": {
                      "type": "string"
                    },
                    "mode": {
                      "const": "list"
                    },
                    "generated": {
                      "const": false
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "score": {
                            "type": "number"
                          },
                          "schema_object": {
                            "type": "object"
                          }
                        },
                        "required": [
                          "id",
                          "url",
                          "name",
                          "description"
                        ]
                      }
                    },
                    "_meta": {
                      "type": "object",
                      "properties": {
                        "response_type": {
                          "const": "answer"
                        },
                        "response_format": {
                          "const": "conversational_search"
                        },
                        "version": {
                          "const": "0.55"
                        }
                      },
                      "required": [
                        "response_type",
                        "response_format",
                        "version"
                      ]
                    }
                  },
                  "required": [
                    "query_id",
                    "query",
                    "mode",
                    "generated",
                    "results",
                    "_meta"
                  ]
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "NLWeb v0.55 start, result, error and complete SSE envelopes."
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or unsupported mode",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "query",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 1000
            }
          },
          {
            "name": "stream",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ]
      },
      "post": {
        "operationId": "searchPublicDocs",
        "summary": "Retrieve public documentation excerpts, not generated answers",
        "security": [],
        "responses": {
          "200": {
            "description": "Ranked retrieval results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "query_id": {
                      "type": "string"
                    },
                    "query": {
                      "type": "string"
                    },
                    "mode": {
                      "const": "list"
                    },
                    "generated": {
                      "const": false
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "score": {
                            "type": "number"
                          },
                          "schema_object": {
                            "type": "object"
                          }
                        },
                        "required": [
                          "id",
                          "url",
                          "name",
                          "description"
                        ]
                      }
                    },
                    "_meta": {
                      "type": "object",
                      "properties": {
                        "response_type": {
                          "const": "answer"
                        },
                        "response_format": {
                          "const": "conversational_search"
                        },
                        "version": {
                          "const": "0.55"
                        }
                      },
                      "required": [
                        "response_type",
                        "response_format",
                        "version"
                      ]
                    }
                  },
                  "required": [
                    "query_id",
                    "query",
                    "mode",
                    "generated",
                    "results",
                    "_meta"
                  ]
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "NLWeb v0.55 start, result, error and complete SSE envelopes."
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or unsupported mode",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 1000
                          },
                          "site": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ]
                      },
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      }
                    ]
                  },
                  "prefer": {
                    "type": "object",
                    "properties": {
                      "streaming": {
                        "type": "boolean"
                      },
                      "mode": {
                        "const": "list"
                      },
                      "response_format": {
                        "const": "conversational_search"
                      }
                    }
                  },
                  "meta": {
                    "type": "object",
                    "properties": {
                      "version": {
                        "const": "0.55"
                      }
                    }
                  }
                },
                "required": [
                  "query"
                ]
              }
            }
          }
        }
      }
    },
    "/sandbox/v1/models": {
      "get": {
        "operationId": "sandboxModels",
        "summary": "Synthetic simulator catalogue; no production models or billing",
        "security": [],
        "responses": {
          "200": {
            "description": "Only the deterministic synthetic model",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "const": "list"
                    },
                    "sandbox": {
                      "const": true
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "const": "pool-sandbox-synthetic"
                          },
                          "object": {
                            "const": "model"
                          },
                          "synthetic": {
                            "const": true
                          }
                        },
                        "required": [
                          "id",
                          "object",
                          "synthetic"
                        ]
                      }
                    }
                  },
                  "required": [
                    "object",
                    "sandbox",
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/sandbox/v1/chat/completions": {
      "post": {
        "operationId": "sandboxChatCompletion",
        "summary": "Deterministic SYNTHETIC response. No model, production data or billing.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "const": "pool-sandbox-synthetic"
                  },
                  "messages": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 32,
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "enum": [
                            "system",
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "type": "string",
                          "maxLength": 4000
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ]
                    }
                  },
                  "stream": {
                    "type": "boolean"
                  },
                  "max_tokens": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4096
                  },
                  "temperature": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 2
                  }
                },
                "required": [
                  "model",
                  "messages"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Synthetic response with zero token usage",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "const": "chat.completion"
                    },
                    "model": {
                      "const": "pool-sandbox-synthetic"
                    },
                    "sandbox": {
                      "const": true
                    },
                    "synthetic": {
                      "const": true
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "usage": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "id",
                    "object",
                    "model",
                    "sandbox",
                    "synthetic",
                    "choices",
                    "usage"
                  ]
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "OpenAI-style synthetic completion chunks ending with data: [DONE]."
                }
              }
            }
          },
          "400": {
            "description": "Unsupported parameter or invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Production model IDs are never routed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "object"
                        }
                      ]
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/": {
      "get": {
        "operationId": "protectedApiEntry",
        "summary": "Protected API entrypoint: discover authentication requirements",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "401": {
            "description": "Missing or invalid bearer credential. Read resource_metadata in WWW-Authenticate.",
            "headers": {
              "WWW-Authenticate": {
                "schema": {
                  "type": "string"
                },
                "description": "Bearer challenge linking https://pool.linkrra.com/.well-known/oauth-protected-resource/v1"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "error"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Authenticated root has no operation; select a documented endpoint."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private account-backed API key; restricted OAuth tokens cannot access batch/file endpoints."
      }
    },
    "schemas": {
      "TaskUsage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prompt_tokens",
          "completion_tokens",
          "total_tokens",
          "calls"
        ],
        "properties": {
          "prompt_tokens": {
            "type": "integer"
          },
          "completion_tokens": {
            "type": "integer"
          },
          "total_tokens": {
            "type": "integer"
          },
          "calls": {
            "type": "integer",
            "description": "Model calls made (2 when a repair retry ran)."
          }
        }
      },
      "TaskPayment": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "paidUsd",
          "quotedUsd",
          "transaction",
          "network",
          "payerAddress"
        ],
        "description": "USDC paid and the settlement transaction; any unused part stays credited to the paying wallet.",
        "properties": {
          "paidUsd": {
            "type": "number"
          },
          "quotedUsd": {
            "type": "number"
          },
          "creditsGranted": {
            "type": "integer"
          },
          "creditsCharged": {
            "type": "integer"
          },
          "creditsRemaining": {
            "type": "integer"
          },
          "transaction": {
            "type": "string"
          },
          "network": {
            "type": "string"
          },
          "payerAddress": {
            "type": "string"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "TaskError": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            }
          },
          "payment": {
            "type": "object",
            "properties": {
              "charged": {
                "type": "boolean",
                "description": "false: the payment was verified but never settled."
              }
            }
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Synthetic API sandbox and limitations",
    "url": "https://pool.linkrra.com/sandbox.md"
  },
  "x-sandbox": {
    "url": "https://pool.linkrra.com/sandbox",
    "apiBaseUrl": "https://pool.linkrra.com/sandbox/v1",
    "model": "pool-sandbox-synthetic",
    "description": "Deterministic test responses only; no production models, accounts or billing."
  }
}
