{
  "openapi": "3.1.0",
  "info": {
    "title": "Gully AI",
    "version": "0.1.0",
    "summary": "Ask questions about Gully Labs products and get answers with sources.",
    "description": "Gully AI answers questions about Gully Labs and its products from the public docs and from live public figures, and always names its sources. This document covers the public HTTP routes: ask a question, rate the answer, and read what Gully AI knows and whether it is answering now.\n\n## Calling it\n\nNo key is needed. Every POST must carry the header `X-Requested-With: gully` and a JSON body. That header cannot be sent from a page on another site, so call the POST routes from your server or from the command line. The two GET routes (status and knowledge) are readable from any origin, including a browser page.\n\n## Limits\n\n| What | Limit |\n|---|---|\n| Question length | 500 characters |\n| Request body | 16 KB |\n| History read | last 4 entries, 600 characters each |\n| Questions from one place | 6 a minute, 60 a day |\n| Written answers, whole service | about 2,000 a day |\n| Docs-passages answers from one place (when the service is full or busy) | 20 a minute, 200 a day |\n| Ratings from one place | 30 a minute, for answers of the last 24 hours |\n\nThese are the defaults; the operators may change them, and `GET /api/ask/knowledge` reports the values in force. One place means one IPv4 address or one IPv6 /64. A day runs on US Pacific time. Over a limit the answer is HTTP 429, with a `Retry-After` header (seconds) on questions. No `X-RateLimit-*` headers are sent. When the whole service has reached its daily limit a question is still answered with HTTP 200, as docs passages with no generated text (`degraded` is set).\n\n## Errors\n\nEvery error is JSON: `{ \"error\": \"<plain words>\" }`, sometimes with a short `code`. Rely on the HTTP status first; most errors carry no code.\n\n| HTTP | code | Meaning |\n|---|---|---|\n| 202 | pending | The transaction is not in a block yet. Ask again shortly. |\n| 400 | none | The body is not the expected JSON, a field is missing or malformed, the question is empty or too long, or the question looks like a private key or recovery phrase. |\n| 400 | bad_input | The transaction hash is not 0x followed by 64 hex characters. |\n| 400 | wrong_chain | Only Gully Chain Testnet is supported for now. |\n| 402 | credits | Not enough credits. Nothing is charged today; this answer exists for a later paid tier. |\n| 403 | none | The `X-Requested-With: gully` header is missing. |\n| 404 | none | The answer can no longer be rated (unknown id or past the rating window), or the route is not switched on yet. |\n| 404 | not_found | No transaction with that hash was found on Gully Chain Testnet. |\n| 405 | none | Wrong method. Questions, ratings and explanations are POST; status and knowledge are GET. |\n| 413 | none | The request body is too large. |\n| 429 | none | Too many requests from one place this minute or today. Wait `Retry-After` seconds when the header is present. |\n| 429 | none | The service has answered as many requests as it can today. Resets at the start of the next day (US Pacific time). On questions this is not an error: the answer becomes docs passages instead. |\n| 500 | none | The rating could not be saved. Try again. |\n| 502 | none | The answer could not be written just now. Try again. |\n| 503 | none | Gully AI is not available yet (`configured` is false), busy, or its writing service did not answer and no docs passages could be found. Try again shortly. |\n| 503 | busy | Too many answers are being written at once. Try again in a minute. |\n| 503 | provider-unavailable | The writing service is unavailable. Try again later. |\n| 503 | unavailable | The chain could not be read just now. Try again shortly. |\n\n## Good to know\n\nAnswers are information only: no advice and no predictions. Questions are logged without a raw IP address (a salted hash only) and kept for a limited time; the knowledge route gives the details and how to ask for deletion.",
    "x-generated-by": "scripts/gen-openapi.mjs"
  },
  "servers": [
    {
      "url": "https://gullylabs.xyz",
      "description": "Gully Labs"
    }
  ],
  "tags": [
    {
      "name": "Ask",
      "description": "Ask Gully AI a question about Gully Labs and its products, and rate the answer."
    },
    {
      "name": "About",
      "description": "What Gully AI knows, where a question goes and whether it is answering now."
    },
    {
      "name": "Explain",
      "description": "A transaction in plain words. Not switched on yet."
    }
  ],
  "paths": {
    "/api/ask": {
      "post": {
        "operationId": "askQuestion",
        "tags": [
          "Ask"
        ],
        "summary": "Ask Gully AI a question",
        "description": "Answers one question about Gully Labs and its products from the public docs, with numbered sources. Some answers also read live public figures (for example a plan price in USD or the status page) and return them as cards.\n\n**Limits.** A question is at most 500 characters and the body at most 16 KB. One visitor may ask 6 questions a minute and 60 a day. The service as a whole writes about 2,000 answers a day.\n\n**History.** Send the earlier turns of the same conversation in `history`. Only the last 4 entries are read and each is cut to 600 characters.\n\n**When the service is full or its writing service is down** the answer is still HTTP 200: `degraded` names the reason, `model` is null and `answer` holds the closest docs passages with links, with no generated text. The `X-Ask-Degraded` header carries the same reason.\n\n**Streaming.** Send `Accept: text/event-stream` to get server-sent events: zero or more `status` events (`{ \"stage\": ... }`), then one `answer` event with the same JSON as the plain answer, or one `error` event (`{ \"error\", \"status\", \"code\"? }`). A request refused before work starts (bad body, missing header, over the limit) is answered with a plain JSON error and its HTTP status, not a stream. Once the stream is open the HTTP status is 200 even when it ends in an `error` event.\n\n**Privacy.** Emails, phone numbers and keys in a question are masked before it is logged or sent on. Never send a private key or recovery phrase: such a question is refused. `GET /api/ask/knowledge` says where a question goes and what is kept.\n\nA visitor signed in to the Gully Labs app in the same browser can also ask about their own workspace; `signedIn` says whether that applied. No key is needed.\n\nInformation only: no advice and no predictions.",
        "security": [],
        "parameters": [
          {
            "name": "X-Requested-With",
            "in": "header",
            "required": true,
            "description": "Must be exactly `gully`. A request without it is refused with 403.",
            "schema": {
              "type": "string",
              "const": "gully"
            },
            "example": "gully"
          },
          {
            "name": "Accept",
            "in": "header",
            "required": false,
            "description": "Send `text/event-stream` for a streamed answer. Anything else gets one JSON answer.",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AskRequest"
              },
              "examples": {
                "question": {
                  "summary": "One question",
                  "value": {
                    "question": "What does Gully AI know about?"
                  }
                },
                "followUp": {
                  "summary": "A follow-up with history",
                  "value": {
                    "question": "And how do I rate an answer?",
                    "history": [
                      {
                        "role": "user",
                        "content": "What does Gully AI know about?"
                      },
                      {
                        "role": "assistant",
                        "content": "It answers from the public docs of Gully Labs products."
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The answer. With `Accept: text/event-stream`, the same answer as server-sent events.",
            "headers": {
              "Cache-Control": {
                "description": "Always `no-store`.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Ask-Degraded": {
                "description": "Present only on a docs-passages answer (not sent on a stream): busy, cap, provider.",
                "schema": {
                  "type": "string",
                  "enum": [
                    "busy",
                    "cap",
                    "provider"
                  ]
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Answer"
                },
                "examples": {
                  "written": {
                    "summary": "A written answer",
                    "value": {
                      "id": "a_AAAAAAAAAAAAAAAA",
                      "answer": "Gully AI answers questions about Gully Labs products from the public docs [1].",
                      "citations": [
                        {
                          "n": 1,
                          "title": "Gully AI",
                          "url": "https://docs.gullylabs.xyz/gully-ai",
                          "source": "docs"
                        }
                      ],
                      "live": [],
                      "cards": [],
                      "actions": [],
                      "usedTools": [],
                      "model": "example-model",
                      "retrieval": "bm25",
                      "signedIn": false
                    }
                  },
                  "passages": {
                    "summary": "Docs passages while the service is full",
                    "value": {
                      "id": "a_AAAAAAAAAAAAAAAA",
                      "answer": "Gully AI has answered as many questions as it can today, so this is not a written answer. These are the closest passages from our docs (no generated text):\n\n[1] Gully AI · Limits: Each visitor can ask a few questions a minute.",
                      "citations": [
                        {
                          "n": 1,
                          "title": "Gully AI",
                          "url": "https://docs.gullylabs.xyz/gully-ai",
                          "source": "docs"
                        }
                      ],
                      "live": [],
                      "cards": [],
                      "actions": [],
                      "usedTools": [],
                      "model": null,
                      "retrieval": "bm25",
                      "degraded": "cap",
                      "signedIn": false
                    }
                  }
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-sent events. Each event is `event: <name>` then `data: <one line of JSON>` then a blank line. Names: `status` (data: StreamStatus), `answer` (data: Answer), `error` (data: StreamError). The stream closes after `answer` or `error`."
                },
                "example": "event: status\ndata: {\"stage\":\"thinking\"}\n\nevent: status\ndata: {\"stage\":\"writing\"}\n\nevent: answer\ndata: {\"id\":\"a_AAAAAAAAAAAAAAAA\",\"answer\":\"Gully AI answers questions about Gully Labs products from the public docs [1].\",\"citations\":[{\"n\":1,\"title\":\"Gully AI\",\"url\":\"https://docs.gullylabs.xyz/gully-ai\",\"source\":\"docs\"}],\"live\":[],\"cards\":[],\"actions\":[],\"usedTools\":[],\"model\":\"example-model\",\"retrieval\":\"bm25\",\"signedIn\":false}\n\n"
              }
            }
          },
          "400": {
            "description": "The body is not `{ question, history? }`, the question is empty or too long, or it looks like a private key or recovery phrase.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "A question can be at most 500 characters."
                }
              }
            }
          },
          "403": {
            "description": "The `X-Requested-With: gully` header is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Cross-site request refused."
                }
              }
            }
          },
          "405": {
            "description": "Only POST is accepted.",
            "headers": {
              "Allow": {
                "description": "The accepted method.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "POST only"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 16 KB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "The request is larger than 16 KB."
                }
              }
            }
          },
          "429": {
            "description": "Too many questions from one place this minute or today.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next try.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "At most 6 questions a minute. Try again shortly."
                }
              }
            }
          },
          "502": {
            "description": "The answer could not be written and no docs passages could be returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "The answer could not be written just now. Try again."
                }
              }
            }
          },
          "503": {
            "description": "Gully AI is not available yet, or it is busy and no docs passages could be returned.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Ask is busy just now. Try again in a minute.",
                  "code": "busy"
                }
              }
            }
          }
        },
        "x-code-samples": [
          {
            "lang": "curl",
            "label": "JSON",
            "source": "curl -X POST https://gullylabs.xyz/api/ask -H \"Content-Type: application/json\" -H \"X-Requested-With: gully\" -d '{\"question\":\"What does Gully AI know about?\"}'"
          },
          {
            "lang": "curl",
            "label": "Stream",
            "source": "curl -X POST https://gullylabs.xyz/api/ask -N -H \"Accept: text/event-stream\" -H \"Content-Type: application/json\" -H \"X-Requested-With: gully\" -d '{\"question\":\"What does Gully AI know about?\"}'"
          }
        ]
      }
    },
    "/api/ask/status": {
      "get": {
        "operationId": "getAskStatus",
        "tags": [
          "About"
        ],
        "summary": "Whether Gully AI is answering now",
        "description": "Whether Gully AI is set up, how many docs passages it can search, when they were last refreshed and whether today's service limit is near. Read-only, no key, readable from any origin. Cached for 60 seconds. HEAD is accepted too.",
        "security": [],
        "responses": {
          "200": {
            "description": "The status.",
            "headers": {
              "Cache-Control": {
                "description": "`public, max-age=60`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AskStatus"
                },
                "example": {
                  "configured": true,
                  "model": "example-model",
                  "indexSize": 500,
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "retrieval": "bm25",
                  "provider": "ok",
                  "since": null,
                  "cap": null
                }
              }
            }
          },
          "405": {
            "description": "Only GET is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "GET only"
                }
              }
            }
          }
        },
        "x-code-samples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl https://gullylabs.xyz/api/ask/status"
          }
        ]
      }
    },
    "/api/ask/knowledge": {
      "get": {
        "operationId": "getAskKnowledge",
        "tags": [
          "About"
        ],
        "summary": "What Gully AI knows and where a question goes",
        "description": "The sources Gully AI answers from, grouped by product (Covered, Thin or Missing), the services that receive the text of a question, what is logged and for how long, how to ask for deletion, and the limits in force. Read-only, no key, readable from any origin. Cached for 300 seconds. HEAD is accepted too.",
        "security": [],
        "responses": {
          "200": {
            "description": "The knowledge document.",
            "headers": {
              "Cache-Control": {
                "description": "`public, max-age=300`.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Knowledge"
                },
                "example": {
                  "products": [
                    {
                      "id": "ai",
                      "name": "Gully AI",
                      "status": "Covered",
                      "passages": 12,
                      "lastIndexedAt": "2026-01-01T00:00:00.000Z",
                      "pages": [
                        {
                          "title": "Gully AI",
                          "url": "https://docs.gullylabs.xyz/gully-ai",
                          "updatedAt": "2026-01-01T00:00:00.000Z"
                        }
                      ],
                      "moreSources": 0
                    }
                  ],
                  "general": {
                    "name": "General",
                    "passages": 40,
                    "lastIndexedAt": "2026-01-01T00:00:00.000Z"
                  },
                  "totals": {
                    "passages": 500,
                    "words": 60000,
                    "pages": 80,
                    "covered": 10,
                    "thin": 3,
                    "missing": 1
                  },
                  "updatedAt": "2026-01-01T00:00:00.000Z",
                  "retrieval": "bm25",
                  "owned": false,
                  "note": "Gully AI is software written around third-party model providers.",
                  "providers": [
                    {
                      "name": "Example provider",
                      "purpose": "writes the answer",
                      "model": "example-model",
                      "active": true,
                      "sends": "your question and the matching passages of the public docs"
                    }
                  ],
                  "retention": {
                    "logDays": 90,
                    "logHolds": "the question, the sources used and a salted hash of your IP address",
                    "ratingsHold": "the rating, the question and the same hash",
                    "rawIp": false
                  },
                  "deletion": {
                    "how": "Send the contact form and say which question you want removed.",
                    "url": "https://gullylabs.xyz/services"
                  },
                  "limits": {
                    "question": 500,
                    "perVisitorPerMin": 6,
                    "perVisitorPerDay": 60,
                    "perChatPerMin": 5,
                    "perChatPerDay": 60,
                    "perDayService": 2000
                  }
                }
              }
            }
          },
          "405": {
            "description": "Only GET is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "GET only"
                }
              }
            }
          }
        },
        "x-code-samples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl https://gullylabs.xyz/api/ask/knowledge"
          }
        ]
      }
    },
    "/api/ask/feedback": {
      "post": {
        "operationId": "rateAnswer",
        "tags": [
          "Ask"
        ],
        "summary": "Rate an answer up or down",
        "description": "Stores one rating for an answer given in the last 24 hours, by its `id`. A second rating of the same answer replaces the first. The question is taken from the server's own record of that answer, never from this request. A thumbs-down also keeps the answer text and its sources so the docs can be fixed. At most 30 ratings a minute from one place; the body is at most 2 KB.",
        "security": [],
        "parameters": [
          {
            "name": "X-Requested-With",
            "in": "header",
            "required": true,
            "description": "Must be exactly `gully`. A request without it is refused with 403.",
            "schema": {
              "type": "string",
              "const": "gully"
            },
            "example": "gully"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FeedbackRequest"
              },
              "example": {
                "id": "a_AAAAAAAAAAAAAAAA",
                "rating": "up"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Saved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true
                }
              }
            }
          },
          "400": {
            "description": "The body is not `{ id, rating }` or a field is malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "rating must be \"up\" or \"down\"."
                }
              }
            }
          },
          "403": {
            "description": "The `X-Requested-With: gully` header is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Cross-site request refused."
                }
              }
            }
          },
          "404": {
            "description": "Unknown answer id, or the answer is older than 24 hours.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "That answer can no longer be rated."
                }
              }
            }
          },
          "405": {
            "description": "Only POST is accepted.",
            "headers": {
              "Allow": {
                "description": "The accepted method.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "POST only"
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 2 KB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Too large."
                }
              }
            }
          },
          "429": {
            "description": "Too many ratings in a minute.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Too many ratings in a minute."
                }
              }
            }
          },
          "500": {
            "description": "The rating could not be saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "The rating could not be saved."
                }
              }
            }
          }
        },
        "x-code-samples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST https://gullylabs.xyz/api/ask/feedback -H \"Content-Type: application/json\" -H \"X-Requested-With: gully\" -d '{\"id\":\"a_AAAAAAAAAAAAAAAA\",\"rating\":\"up\"}'"
          }
        ]
      }
    },
    "/api/ai/explain-tx": {
      "post": {
        "operationId": "explainTransaction",
        "tags": [
          "Explain"
        ],
        "summary": "Explain a transaction in plain words (not switched on yet)",
        "description": "**Not switched on yet.** Until it is, every call is answered with HTTP 404 `{ \"error\": \"not found\" }`. The shape below is what it answers once it is on, and may still change.\n\nReads one transaction on Gully Chain Testnet (chain 485590) and returns the facts (who sent it, what moved, approvals, the fee in ETH and USD) and a short explanation written only from those facts. When the explanation cannot be written or does not match the facts, a fixed-template explanation is returned instead and `source` is `template`.\n\n**Limits.** 4 calls a minute and 40 a day from one place, inside the same service-wide daily limit as questions. The body is at most 2 KB.\n\nEvery answer carries the label \"Testnet: no real value\". USD figures use current prices, not the price at the time of the transaction. Information only.",
        "x-status": "off",
        "security": [],
        "parameters": [
          {
            "name": "X-Requested-With",
            "in": "header",
            "required": true,
            "description": "Must be exactly `gully`. A request without it is refused with 403.",
            "schema": {
              "type": "string",
              "const": "gully"
            },
            "example": "gully"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExplainRequest"
              },
              "example": {
                "chainId": 485590,
                "txHash": "0xabababababababababababababababababababababababababababababababab"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The facts and the explanation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Explanation"
                },
                "example": {
                  "ok": true,
                  "explanation": "The sender moved 1.5 EXAMPLE to another address. The network fee was under $0.01. Testnet: no real value.",
                  "source": "template",
                  "label": "Testnet: no real value",
                  "facts": {
                    "schema": 1,
                    "chain": {
                      "id": 485590,
                      "name": "Gully Chain Testnet",
                      "testnet": true,
                      "label": "Testnet: no real value"
                    },
                    "tx": {
                      "hash": "0xabababababababababababababababababababababababababababababababab",
                      "status": "success",
                      "block": 1000000,
                      "from": "0x1111111111111111111111111111111111111111",
                      "to": "0x3333333333333333333333333333333333333333",
                      "valueEth": null,
                      "valueUsd": null,
                      "revertReason": null
                    },
                    "method": {
                      "name": "transfer",
                      "signature": "transfer(address,uint256)",
                      "source": "known"
                    },
                    "actor": {
                      "address": "0x1111111111111111111111111111111111111111",
                      "short": "0x1111…1111"
                    },
                    "aa": null,
                    "fee": {
                      "eth": "0.000001",
                      "usd": "$0.01",
                      "paidBy": "sender"
                    },
                    "transfers": [
                      {
                        "kind": "token",
                        "logIndex": 0,
                        "token": "0x3333333333333333333333333333333333333333",
                        "from": "0x1111111111111111111111111111111111111111",
                        "to": "0x2222222222222222222222222222222222222222",
                        "symbol": "EXAMPLE",
                        "amount": "1.5",
                        "usd": null
                      }
                    ],
                    "approvals": [],
                    "contracts": [
                      {
                        "address": "0x3333333333333333333333333333333333333333",
                        "sourcePublished": true
                      }
                    ],
                    "counts": {
                      "transfers": 1,
                      "approvals": 0,
                      "logs": 1
                    },
                    "notes": [
                      "Dollar figures use current prices, not the price at the time of the transaction."
                    ]
                  }
                }
              }
            }
          },
          "202": {
            "description": "The transaction is not in a block yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "That transaction has not been included in a block yet.",
                  "code": "pending"
                }
              }
            }
          },
          "400": {
            "description": "Not a transaction hash, another chain, or a body that is not JSON.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Send a 0x transaction hash (66 characters).",
                  "code": "bad_input"
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits. Nothing is charged today.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Not enough credits.",
                  "code": "credits"
                }
              }
            }
          },
          "403": {
            "description": "The `X-Requested-With: gully` header is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Cross-site request refused."
                }
              }
            }
          },
          "404": {
            "description": "Not switched on yet, or (once on) no transaction with that hash was found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "off": {
                    "summary": "Not switched on yet",
                    "value": {
                      "error": "not found"
                    }
                  },
                  "unknown": {
                    "summary": "Unknown transaction",
                    "value": {
                      "error": "No transaction with that hash was found on Gully Chain Testnet.",
                      "code": "not_found"
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Only POST is accepted.",
            "headers": {
              "Allow": {
                "description": "The accepted method.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "POST only"
                }
              }
            }
          },
          "429": {
            "description": "Too many calls from one place, or the service-wide daily limit is reached.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next try.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "At most 4 questions a minute. Try again shortly."
                }
              }
            }
          },
          "503": {
            "description": "The chain could not be read just now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "The chain could not be read just now. Try again shortly.",
                  "code": "unavailable"
                }
              }
            }
          }
        },
        "x-code-samples": [
          {
            "lang": "curl",
            "label": "curl",
            "source": "curl -X POST https://gullylabs.xyz/api/ai/explain-tx -H \"Content-Type: application/json\" -H \"X-Requested-With: gully\" -d '{\"txHash\":\"0xabababababababababababababababababababababababababababababababab\"}'"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "AskRequest": {
        "type": "object",
        "required": [
          "question"
        ],
        "properties": {
          "question": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500,
            "description": "The question, in plain words. Runs of spaces are collapsed before the length is checked."
          },
          "history": {
            "type": "array",
            "description": "Earlier turns of this conversation, oldest first. Only the last 4 entries are read; each is cut to 600 characters.",
            "items": {
              "type": "object",
              "required": [
                "role",
                "content"
              ],
              "properties": {
                "role": {
                  "type": "string",
                  "enum": [
                    "user",
                    "assistant"
                  ]
                },
                "content": {
                  "type": "string"
                }
              }
            }
          },
          "holders": {
            "type": [
              "object",
              "null"
            ],
            "description": "Optional: the Holder Map the question is asked from, so the answer can read that map.",
            "properties": {
              "chain": {
                "type": "string",
                "description": "Chain name as the Holder Map uses it.",
                "examples": [
                  "bsc"
                ]
              },
              "token": {
                "type": "string",
                "maxLength": 64,
                "description": "Token address or ticker: letters and digits only.",
                "examples": [
                  "0x3333333333333333333333333333333333333333"
                ]
              }
            }
          }
        }
      },
      "Answer": {
        "type": "object",
        "required": [
          "id",
          "answer",
          "citations",
          "live",
          "cards",
          "actions",
          "usedTools",
          "model",
          "signedIn"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^a_[A-Za-z0-9_-]{16}$",
            "description": "Use it to rate the answer within 24 hours."
          },
          "answer": {
            "type": "string",
            "description": "The answer text. `[1]` marks a source in `citations`; `[L1]` marks a live read in `live`."
          },
          "citations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Citation"
            }
          },
          "live": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LiveRead"
            }
          },
          "cards": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "$ref": "#/components/schemas/Card"
            }
          },
          "actions": {
            "type": "array",
            "maxItems": 4,
            "items": {
              "$ref": "#/components/schemas/Action"
            }
          },
          "usedTools": {
            "type": "array",
            "description": "Names of the live reads the answer used.",
            "items": {
              "type": "string",
              "examples": [
                "get_alert_channels",
                "get_gully_score",
                "get_holders"
              ]
            }
          },
          "model": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name of the model that wrote the answer. null on a docs-passages answer."
          },
          "retrieval": {
            "type": "string",
            "enum": [
              "hybrid",
              "bm25"
            ],
            "description": "How the docs were searched: by keywords, or keywords plus meaning."
          },
          "degraded": {
            "type": "string",
            "enum": [
              "busy",
              "cap",
              "provider"
            ],
            "description": "Present only when the answer is docs passages with no generated text: the service-wide daily limit was reached (cap), too many answers were being written (busy), or the writing service did not answer (provider)."
          },
          "signedIn": {
            "type": "boolean",
            "description": "true when the request came from a visitor signed in to the Gully Labs app."
          }
        }
      },
      "Citation": {
        "type": "object",
        "required": [
          "n",
          "title",
          "url",
          "source"
        ],
        "properties": {
          "n": {
            "type": "integer",
            "description": "The number used in the answer text."
          },
          "title": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "source": {
            "type": "string",
            "description": "The kind of page, for example docs or blog."
          }
        }
      },
      "LiveRead": {
        "type": "object",
        "required": [
          "n",
          "tool",
          "label",
          "url"
        ],
        "properties": {
          "n": {
            "type": "string",
            "description": "The label used in the answer text.",
            "examples": [
              "L1"
            ]
          },
          "tool": {
            "type": "string",
            "description": "Name of the live read.",
            "examples": [
              "get_alert_channels",
              "get_gully_score",
              "get_holders"
            ]
          },
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Where the figures can be checked."
          },
          "asOf": {
            "description": "When the figures were read (ISO time or a millisecond timestamp).",
            "type": [
              "string",
              "number",
              "null"
            ]
          }
        }
      },
      "Card": {
        "type": "object",
        "description": "A small panel built from a live read itself, never from the generated text, so its figures are exactly what was read.",
        "required": [
          "kind",
          "tool",
          "title",
          "stats"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "alerts",
              "chains",
              "gaps",
              "gas",
              "holders",
              "ledger",
              "plans",
              "reports",
              "score",
              "security",
              "status",
              "stock",
              "store",
              "usage"
            ]
          },
          "tool": {
            "type": "string"
          },
          "cite": {
            "type": "string",
            "description": "The live read it belongs to.",
            "examples": [
              "L1"
            ]
          },
          "asOf": {
            "type": [
              "string",
              "number",
              "null"
            ]
          },
          "source": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "label": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "title": {
            "type": "string"
          },
          "subtitle": {
            "type": "string"
          },
          "stats": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "label",
                "value"
              ],
              "properties": {
                "label": {
                  "type": "string"
                },
                "value": {
                  "type": "string",
                  "description": "Already formatted for display. Money is in USD."
                },
                "tone": {
                  "type": "string",
                  "enum": [
                    "ok",
                    "warn",
                    "up",
                    "down"
                  ]
                }
              }
            }
          },
          "chart": {
            "type": [
              "object",
              "null"
            ],
            "description": "A small line (`spark`: `points`, oldest first) or bars (`bars`). Absent or null with fewer than two points.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "spark",
                  "bars"
                ]
              },
              "points": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              },
              "bars": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "value": {
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  }
                }
              },
              "unit": {
                "type": "string",
                "examples": [
                  "%",
                  "$"
                ]
              },
              "label": {
                "type": "string"
              }
            }
          },
          "link": {
            "type": "object",
            "properties": {
              "label": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "note": {
            "type": "string"
          }
        }
      },
      "Action": {
        "type": "object",
        "description": "A suggested next step as a link. `prefill` opens a form already filled in; nothing is created until the visitor saves it.",
        "required": [
          "kind",
          "label",
          "url"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "link",
              "prefill"
            ]
          },
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "note": {
            "type": "string"
          }
        }
      },
      "StreamStatus": {
        "type": "object",
        "description": "Data of a `status` event.",
        "required": [
          "stage"
        ],
        "properties": {
          "stage": {
            "type": "string",
            "description": "What is happening now: `thinking`, `tool:<name>`, `writing` (`tool:<name>` names the live read in progress).",
            "examples": [
              "thinking",
              "tool:<name>",
              "writing"
            ]
          }
        }
      },
      "StreamError": {
        "type": "object",
        "description": "Data of an `error` event.",
        "required": [
          "error",
          "status"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status the same failure has without streaming."
          },
          "code": {
            "type": "string"
          }
        }
      },
      "FeedbackRequest": {
        "type": "object",
        "required": [
          "id",
          "rating"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^a_[A-Za-z0-9_-]{16}$",
            "description": "The `id` of the answer."
          },
          "rating": {
            "type": "string",
            "enum": [
              "up",
              "down"
            ]
          }
        }
      },
      "AskStatus": {
        "type": "object",
        "required": [
          "configured",
          "model",
          "indexSize",
          "updatedAt",
          "retrieval",
          "provider",
          "cap"
        ],
        "properties": {
          "configured": {
            "type": "boolean",
            "description": "false while Gully AI is not set up: questions are answered with 503."
          },
          "model": {
            "type": "string",
            "description": "Name of the model that writes answers."
          },
          "indexSize": {
            "type": "integer",
            "description": "Docs passages that can be searched."
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the passages were last refreshed."
          },
          "retrieval": {
            "type": "string",
            "enum": [
              "hybrid",
              "bm25"
            ]
          },
          "provider": {
            "type": "string",
            "enum": [
              "ok",
              "degraded",
              "unavailable"
            ],
            "description": "Whether the writing service is answering."
          },
          "since": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Since when `provider` has had its current value, when known."
          },
          "cap": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "warn",
              "full",
              null
            ],
            "description": "Today's service-wide limit: null, `warn` at 80 % or `full` when reached (answers become docs passages)."
          }
        }
      },
      "Knowledge": {
        "type": "object",
        "required": [
          "products",
          "general",
          "totals",
          "providers",
          "retention",
          "deletion",
          "limits"
        ],
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "Covered",
                    "Thin",
                    "Missing"
                  ],
                  "description": "How much Gully AI has to answer from for this product."
                },
                "passages": {
                  "type": "integer"
                },
                "lastIndexedAt": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "date-time"
                },
                "pages": {
                  "type": "array",
                  "maxItems": 40,
                  "items": {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      },
                      "updatedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      }
                    }
                  }
                },
                "moreSources": {
                  "type": "integer",
                  "description": "Pages beyond the 40 listed."
                }
              }
            }
          },
          "general": {
            "type": "object",
            "description": "Passages that name no single product.",
            "properties": {
              "name": {
                "type": "string"
              },
              "passages": {
                "type": "integer"
              },
              "lastIndexedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "totals": {
            "type": "object",
            "properties": {
              "passages": {
                "type": "integer"
              },
              "words": {
                "type": "integer"
              },
              "pages": {
                "type": "integer"
              },
              "covered": {
                "type": "integer"
              },
              "thin": {
                "type": "integer"
              },
              "missing": {
                "type": "integer"
              }
            }
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "retrieval": {
            "type": "string",
            "enum": [
              "hybrid",
              "bm25"
            ]
          },
          "owned": {
            "type": "boolean",
            "description": "false: Gully AI is software around third-party model providers, not a model Gully Labs trains or hosts."
          },
          "note": {
            "type": "string"
          },
          "providers": {
            "type": "array",
            "description": "The services that receive text, and exactly what they receive.",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "purpose": {
                  "type": "string"
                },
                "model": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "active": {
                  "type": "boolean"
                },
                "sends": {
                  "type": "string"
                }
              }
            }
          },
          "retention": {
            "type": "object",
            "properties": {
              "logDays": {
                "type": "integer"
              },
              "logHolds": {
                "type": "string"
              },
              "ratingsHold": {
                "type": "string"
              },
              "rawIp": {
                "type": "boolean",
                "description": "false: a raw IP address is never stored."
              }
            }
          },
          "deletion": {
            "type": "object",
            "properties": {
              "how": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            }
          },
          "limits": {
            "type": "object",
            "description": "The limits in force now.",
            "properties": {
              "question": {
                "type": "integer"
              },
              "perVisitorPerMin": {
                "type": "integer"
              },
              "perVisitorPerDay": {
                "type": "integer"
              },
              "perChatPerMin": {
                "type": "integer",
                "description": "Per chat on the Telegram bot."
              },
              "perChatPerDay": {
                "type": "integer"
              },
              "perDayService": {
                "type": "integer"
              }
            }
          }
        }
      },
      "ExplainRequest": {
        "type": "object",
        "required": [
          "txHash"
        ],
        "properties": {
          "txHash": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{64}$",
            "description": "Transaction hash."
          },
          "chainId": {
            "type": "integer",
            "const": 485590,
            "description": "Optional. Only 485590 (Gully Chain Testnet) is supported for now."
          }
        }
      },
      "Explanation": {
        "type": "object",
        "required": [
          "ok",
          "explanation",
          "source",
          "label",
          "facts"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "explanation": {
            "type": "string",
            "description": "A few plain sentences written only from `facts`."
          },
          "source": {
            "type": "string",
            "enum": [
              "model",
              "template"
            ],
            "description": "`template` when the fixed wording was used."
          },
          "label": {
            "type": "string",
            "const": "Testnet: no real value"
          },
          "facts": {
            "$ref": "#/components/schemas/TransactionFacts"
          },
          "fellBackBecause": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string"
            },
            "description": "Present when `source` is `template`: why the written explanation was not used."
          },
          "usage": {
            "type": "object",
            "description": "Present when a model wrote the explanation: its token counts.",
            "additionalProperties": true
          }
        }
      },
      "TransactionFacts": {
        "type": "object",
        "description": "What was read from the chain. Money is in ETH and USD; USD fields are null when no price was available.",
        "properties": {
          "schema": {
            "type": "integer",
            "const": 1
          },
          "chain": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "testnet": {
                "type": "boolean"
              },
              "label": {
                "type": "string"
              }
            }
          },
          "tx": {
            "type": "object",
            "properties": {
              "hash": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "success",
                  "reverted"
                ]
              },
              "block": {
                "type": "integer"
              },
              "from": {
                "type": "string"
              },
              "to": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "valueEth": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "valueUsd": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "revertReason": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "method": {
            "type": "object",
            "properties": {
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "signature": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "actor": {
            "type": "object",
            "description": "Who acted: the sender, or the smart account behind a bundled operation.",
            "properties": {
              "address": {
                "type": "string"
              },
              "short": {
                "type": "string"
              }
            }
          },
          "aa": {
            "type": [
              "object",
              "null"
            ],
            "description": "Set when the transaction carries smart-account operations.",
            "properties": {
              "isUserOp": {
                "type": "boolean"
              },
              "bundler": {
                "type": "string"
              },
              "userOps": {
                "type": "integer"
              },
              "sender": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "paymaster": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sponsored": {
                "type": "boolean"
              },
              "userOpSuccess": {
                "type": [
                  "boolean",
                  "null"
                ]
              }
            }
          },
          "fee": {
            "type": "object",
            "properties": {
              "eth": {
                "type": "string"
              },
              "usd": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "paidBy": {
                "type": "string"
              }
            }
          },
          "transfers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "kind": {
                  "type": "string"
                },
                "logIndex": {
                  "type": "integer"
                },
                "token": {
                  "type": "string"
                },
                "from": {
                  "type": "string"
                },
                "to": {
                  "type": "string"
                },
                "symbol": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "amount": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "usd": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tokenId": {
                  "type": "string"
                }
              }
            }
          },
          "approvals": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "logIndex": {
                  "type": "integer"
                },
                "token": {
                  "type": "string"
                },
                "symbol": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "owner": {
                  "type": "string"
                },
                "spender": {
                  "type": "string"
                },
                "amount": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "A formatted amount, or `unlimited`."
                }
              }
            }
          },
          "contracts": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "type": "object",
              "properties": {
                "address": {
                  "type": "string"
                },
                "sourcePublished": {
                  "type": [
                    "boolean",
                    "null"
                  ],
                  "description": "Whether the contract source is published."
                }
              }
            }
          },
          "counts": {
            "type": "object",
            "properties": {
              "transfers": {
                "type": "integer"
              },
              "approvals": {
                "type": "integer"
              },
              "logs": {
                "type": "integer"
              }
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "graph": {
            "type": "object",
            "description": "The same facts as nodes, edges and steps for drawing a flow.",
            "additionalProperties": true
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "The reason, in plain words."
          },
          "code": {
            "type": "string",
            "enum": [
              "bad_input",
              "busy",
              "credits",
              "not_found",
              "pending",
              "provider-unavailable",
              "unavailable",
              "wrong_chain"
            ],
            "description": "A short code. Most errors carry none."
          },
          "configured": {
            "type": "boolean",
            "description": "false on the 503 sent while Gully AI is not set up."
          }
        }
      }
    }
  },
  "x-rate-limit": {
    "headers": [
      "Retry-After"
    ],
    "note": "No X-RateLimit-* headers are sent. Retry-After (seconds) comes with a 429 on questions and explanations. Defaults: 6 questions a minute and 60 a day from one place.",
    "perVisitor": {
      "perMinute": 6,
      "perDay": 60
    },
    "service": {
      "perDay": 2000
    }
  },
  "x-errors": [
    {
      "code": "pending",
      "http": 202,
      "meaning": "The transaction is not in a block yet. Ask again shortly.",
      "operations": [
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 400,
      "meaning": "The body is not the expected JSON, a field is missing or malformed, the question is empty or too long, or the question looks like a private key or recovery phrase.",
      "operations": [
        "askQuestion",
        "rateAnswer",
        "explainTransaction"
      ]
    },
    {
      "code": "bad_input",
      "http": 400,
      "meaning": "The transaction hash is not 0x followed by 64 hex characters.",
      "operations": [
        "explainTransaction"
      ]
    },
    {
      "code": "wrong_chain",
      "http": 400,
      "meaning": "Only Gully Chain Testnet is supported for now.",
      "operations": [
        "explainTransaction"
      ]
    },
    {
      "code": "credits",
      "http": 402,
      "meaning": "Not enough credits. Nothing is charged today; this answer exists for a later paid tier.",
      "operations": [
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 403,
      "meaning": "The `X-Requested-With: gully` header is missing.",
      "operations": [
        "askQuestion",
        "rateAnswer",
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 404,
      "meaning": "The answer can no longer be rated (unknown id or past the rating window), or the route is not switched on yet.",
      "operations": [
        "rateAnswer",
        "explainTransaction"
      ]
    },
    {
      "code": "not_found",
      "http": 404,
      "meaning": "No transaction with that hash was found on Gully Chain Testnet.",
      "operations": [
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 405,
      "meaning": "Wrong method. Questions, ratings and explanations are POST; status and knowledge are GET.",
      "operations": [
        "askQuestion",
        "getAskStatus",
        "getAskKnowledge",
        "rateAnswer",
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 413,
      "meaning": "The request body is too large.",
      "operations": [
        "askQuestion",
        "rateAnswer"
      ]
    },
    {
      "code": null,
      "http": 429,
      "meaning": "Too many requests from one place this minute or today. Wait `Retry-After` seconds when the header is present.",
      "operations": [
        "askQuestion",
        "rateAnswer",
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 429,
      "meaning": "The service has answered as many requests as it can today. Resets at the start of the next day (US Pacific time). On questions this is not an error: the answer becomes docs passages instead.",
      "operations": [
        "explainTransaction"
      ]
    },
    {
      "code": null,
      "http": 500,
      "meaning": "The rating could not be saved. Try again.",
      "operations": [
        "rateAnswer"
      ]
    },
    {
      "code": null,
      "http": 502,
      "meaning": "The answer could not be written just now. Try again.",
      "operations": [
        "askQuestion"
      ]
    },
    {
      "code": null,
      "http": 503,
      "meaning": "Gully AI is not available yet (`configured` is false), busy, or its writing service did not answer and no docs passages could be found. Try again shortly.",
      "operations": [
        "askQuestion"
      ]
    },
    {
      "code": "busy",
      "http": 503,
      "meaning": "Too many answers are being written at once. Try again in a minute.",
      "operations": [
        "askQuestion"
      ]
    },
    {
      "code": "provider-unavailable",
      "http": 503,
      "meaning": "The writing service is unavailable. Try again later.",
      "operations": [
        "askQuestion"
      ]
    },
    {
      "code": "unavailable",
      "http": 503,
      "meaning": "The chain could not be read just now. Try again shortly.",
      "operations": [
        "explainTransaction"
      ]
    }
  ],
  "x-try-it": {
    "keyless": true,
    "operations": [
      "getAskStatus",
      "getAskKnowledge"
    ],
    "note": "The two GET routes need no key and are readable from any origin. Asking a question, rating and explaining are POST routes that need a header a page on another site cannot send, and a question uses the shared daily allowance, so the hub shows curl for those."
  }
}
