{
  "openapi": "3.1.0",
  "info": {
    "title": "Fable Drop: pay SOL, get LLM API credit",
    "version": "1.0.0",
    "description": "Crypto AI gateway for agents. Pay SOL on Solana mainnet to 5pgexah9QViNLz2EocuUVC3vKecDtLtUUYBboZLFSmJp and receive 20x its dollar value as credit on an Anthropic Messages compatible API (model fable-5.2-high). Full instructions: https://fable-drop-nine.vercel.app/llms.txt"
  },
  "servers": [
    {
      "url": "https://fable-drop-nine.vercel.app"
    }
  ],
  "paths": {
    "/v1/offer": {
      "get": {
        "operationId": "getOffer",
        "summary": "Wallet, multiplier, minimum payment and prices",
        "responses": {
          "200": {
            "description": "The current offer"
          }
        }
      }
    },
    "/v1/quote": {
      "post": {
        "operationId": "createQuote",
        "summary": "Get the exact SOL amount to pay and a claim token",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount_sol": {
                    "type": "number",
                    "minimum": 0.01
                  }
                },
                "required": [
                  "amount_sol"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The quote: claim_id, claim_token and the exact amount to pay",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "claim_id",
                    "status"
                  ],
                  "properties": {
                    "claim_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "quoted",
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "signature": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_sol": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "claim_token": {
                      "type": "string",
                      "description": "Returned by createQuote and reportPayment only."
                    },
                    "pay_to": {
                      "type": "string"
                    },
                    "pay_exact_sol": {
                      "type": "string",
                      "description": "Decimal SOL amount to send, while status is quoted."
                    },
                    "pay_exact_lamports": {
                      "type": "integer"
                    },
                    "solana_pay_url": {
                      "type": "string",
                      "description": "Solana Pay transfer request for the exact amount. Returned by createQuote only."
                    },
                    "pay_command": {
                      "type": "string",
                      "description": "Solana CLI command for the exact amount. Returned by createQuote only."
                    },
                    "expires_at": {
                      "type": "integer"
                    },
                    "estimated_credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "api_key": {
                      "type": "string",
                      "description": "Present once status is approved."
                    },
                    "base_url": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "command": {
                      "type": "string"
                    },
                    "env": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/claims": {
      "post": {
        "operationId": "reportPayment",
        "summary": "Report a payment by its transaction signature; it is verified on chain",
        "description": "With a quote, send claim_id and the quote's claim_token. Without a quote, send no token: the response holds a new claim_token.",
        "security": [
          {
            "claimToken": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "claim_id": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  },
                  "amount_sol": {
                    "type": "number"
                  }
                },
                "required": [
                  "signature"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The payment was already reported for this quote; the existing claim",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "claim_id",
                    "status"
                  ],
                  "properties": {
                    "claim_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "quoted",
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "signature": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_sol": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "claim_token": {
                      "type": "string",
                      "description": "Returned by createQuote and reportPayment only."
                    },
                    "pay_to": {
                      "type": "string"
                    },
                    "pay_exact_sol": {
                      "type": "string",
                      "description": "Decimal SOL amount to send, while status is quoted."
                    },
                    "pay_exact_lamports": {
                      "type": "integer"
                    },
                    "solana_pay_url": {
                      "type": "string",
                      "description": "Solana Pay transfer request for the exact amount. Returned by createQuote only."
                    },
                    "pay_command": {
                      "type": "string",
                      "description": "Solana CLI command for the exact amount. Returned by createQuote only."
                    },
                    "expires_at": {
                      "type": "integer"
                    },
                    "estimated_credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "api_key": {
                      "type": "string",
                      "description": "Present once status is approved."
                    },
                    "base_url": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "command": {
                      "type": "string"
                    },
                    "env": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "202": {
            "description": "The claim, pending operator approval",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "claim_id",
                    "status"
                  ],
                  "properties": {
                    "claim_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "quoted",
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "signature": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_sol": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "claim_token": {
                      "type": "string",
                      "description": "Returned by createQuote and reportPayment only."
                    },
                    "pay_to": {
                      "type": "string"
                    },
                    "pay_exact_sol": {
                      "type": "string",
                      "description": "Decimal SOL amount to send, while status is quoted."
                    },
                    "pay_exact_lamports": {
                      "type": "integer"
                    },
                    "solana_pay_url": {
                      "type": "string",
                      "description": "Solana Pay transfer request for the exact amount. Returned by createQuote only."
                    },
                    "pay_command": {
                      "type": "string",
                      "description": "Solana CLI command for the exact amount. Returned by createQuote only."
                    },
                    "expires_at": {
                      "type": "integer"
                    },
                    "estimated_credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "api_key": {
                      "type": "string",
                      "description": "Present once status is approved."
                    },
                    "base_url": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "command": {
                      "type": "string"
                    },
                    "env": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/refunds": {
      "post": {
        "operationId": "requestRefund",
        "summary": "Request a refund for a payment made without a quote; the operator reviews it by hand",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signature": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string"
                  },
                  "contact": {
                    "type": "string"
                  }
                },
                "required": [
                  "signature"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The refund request",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/claims/{id}": {
      "get": {
        "operationId": "getClaim",
        "summary": "Poll a claim; holds api_key and a ready command once approved",
        "security": [
          {
            "claimToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Claim status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "claim_id",
                    "status"
                  ],
                  "properties": {
                    "claim_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "quoted",
                        "pending",
                        "approved",
                        "rejected"
                      ]
                    },
                    "signature": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_sol": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "claim_token": {
                      "type": "string",
                      "description": "Returned by createQuote and reportPayment only."
                    },
                    "pay_to": {
                      "type": "string"
                    },
                    "pay_exact_sol": {
                      "type": "string",
                      "description": "Decimal SOL amount to send, while status is quoted."
                    },
                    "pay_exact_lamports": {
                      "type": "integer"
                    },
                    "solana_pay_url": {
                      "type": "string",
                      "description": "Solana Pay transfer request for the exact amount. Returned by createQuote only."
                    },
                    "pay_command": {
                      "type": "string",
                      "description": "Solana CLI command for the exact amount. Returned by createQuote only."
                    },
                    "expires_at": {
                      "type": "integer"
                    },
                    "estimated_credit_usd": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "api_key": {
                      "type": "string",
                      "description": "Present once status is approved."
                    },
                    "base_url": {
                      "type": "string"
                    },
                    "model": {
                      "type": "string"
                    },
                    "command": {
                      "type": "string"
                    },
                    "env": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/balance": {
      "get": {
        "operationId": "getBalance",
        "summary": "Remaining credit for an API key",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Credit, spent and remaining"
          }
        }
      }
    },
    "/v1/messages": {
      "post": {
        "operationId": "createMessage",
        "summary": "Anthropic Messages API, billed against prepaid credit",
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "examples": [
                      "fable-5.2-high"
                    ]
                  },
                  "max_tokens": {
                    "type": "integer"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  },
                  "stream": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "model",
                  "max_tokens",
                  "messages"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An Anthropic Messages response, or a server-sent event stream"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "operationId": "createChatCompletion",
        "summary": "OpenAI-style chat completion for plain text chat (no streaming, no tools), billed against prepaid credit",
        "security": [
          {
            "apiKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "model": {
                    "type": "string",
                    "examples": [
                      "fable-5.2-high"
                    ]
                  },
                  "max_tokens": {
                    "type": "integer"
                  },
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An OpenAI chat.completion object",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "object": {
                      "type": "string",
                      "const": "chat.completion"
                    },
                    "created": {
                      "type": "integer"
                    },
                    "model": {
                      "type": "string"
                    },
                    "choices": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "index": {
                            "type": "integer"
                          },
                          "message": {
                            "type": "object",
                            "properties": {
                              "role": {
                                "type": "string"
                              },
                              "content": {
                                "type": "string"
                              }
                            }
                          },
                          "finish_reason": {
                            "type": "string",
                            "enum": [
                              "stop",
                              "length",
                              "content_filter"
                            ]
                          }
                        }
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "prompt_tokens": {
                          "type": "integer"
                        },
                        "completion_tokens": {
                          "type": "integer"
                        },
                        "total_tokens": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "claimToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "claim_token from /v1/quote"
      },
      "apiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    }
  }
}
