{
  "openapi": "3.1.0",
  "info": {
    "title": "momoAI",
    "version": "3.0.0",
    "description": "Pay-per-use LLM API. Chat, reasoning, code review, translation, summarization, data extraction, and more. Pay with USDC on Base.",
    "x-guidance": "Pay-per-use LLM API. Send a request, get a 402 with payment instructions, pay with USDC, get your response.",
    "contact": {
      "email": "hello@momoai.xyz"
    },
    "x-logo": {
      "url": "https://momoai-cyan.vercel.app/favicon.png"
    }
  },
  "servers": [
    {
      "url": "https://momoai.vercel.app"
    }
  ],
  "paths": {
    "/api/chat": {
      "post": {
        "operationId": "chat",
        "summary": "Chat Completion",
        "description": "Fast LLM chat powered by Flash model. Ideal for general tasks, Q&A, and simple generation.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "system",
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ]
                    }
                  },
                  "max_tokens": {
                    "type": "integer",
                    "default": 4096
                  },
                  "temperature": {
                    "type": "number",
                    "default": 0.7
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Chat completion response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object",
                          "properties": {
                            "prompt_tokens": {
                              "type": "integer"
                            },
                            "completion_tokens": {
                              "type": "integer"
                            },
                            "total_tokens": {
                              "type": "integer"
                            }
                          }
                        },
                        "finish_reason": {
                          "type": "string"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "endpoint": {
                          "type": "string"
                        },
                        "price": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/think": {
      "post": {
        "operationId": "think",
        "summary": "Deep Reasoning",
        "description": "Advanced reasoning with Pro model and deep thinking mode. Best for complex analysis, coding, math.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "role": {
                          "type": "string",
                          "enum": [
                            "system",
                            "user",
                            "assistant"
                          ]
                        },
                        "content": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ]
                    }
                  },
                  "max_tokens": {
                    "type": "integer",
                    "default": 8192
                  },
                  "temperature": {
                    "type": "number",
                    "default": 0.3
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Deep reasoning response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object",
                          "properties": {
                            "prompt_tokens": {
                              "type": "integer"
                            },
                            "completion_tokens": {
                              "type": "integer"
                            },
                            "total_tokens": {
                              "type": "integer"
                            }
                          }
                        },
                        "finish_reason": {
                          "type": "string"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "endpoint": {
                          "type": "string"
                        },
                        "price": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "deep_thinking": {
                          "type": "boolean"
                        },
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/code": {
      "post": {
        "operationId": "code",
        "summary": "Code Review + Security Scan",
        "description": "Analyze code for bugs, security vulnerabilities, performance issues, and best practices. Returns structured review with score.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Source code to review"
                  },
                  "language": {
                    "type": "string",
                    "description": "Programming language (auto-detect if omitted)"
                  },
                  "focus": {
                    "type": "string",
                    "enum": [
                      "security",
                      "performance",
                      "quality",
                      "all"
                    ],
                    "default": "all"
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Code review result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "review": {
                          "type": "object",
                          "properties": {
                            "score": {
                              "type": "integer"
                            },
                            "issues": {
                              "type": "array"
                            },
                            "suggestions": {
                              "type": "array"
                            },
                            "summary": {
                              "type": "string"
                            }
                          }
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "endpoint": {
                          "type": "string"
                        },
                        "price": {
                          "type": "string"
                        },
                        "language": {
                          "type": "string"
                        },
                        "focus": {
                          "type": "string"
                        },
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/translate": {
      "post": {
        "operationId": "translate",
        "summary": "Translation + Localization",
        "description": "Translate text between 50+ languages with tone control and idiom localization.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text to translate"
                  },
                  "target_lang": {
                    "type": "string",
                    "description": "Target language code (e.g. ja, zh, es, id)"
                  },
                  "source_lang": {
                    "type": "string",
                    "description": "Source language code (auto-detect if omitted)"
                  },
                  "tone": {
                    "type": "string",
                    "enum": [
                      "formal",
                      "casual",
                      "technical",
                      "natural"
                    ],
                    "default": "natural"
                  }
                },
                "required": [
                  "text",
                  "target_lang"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Translation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "translation": {
                          "type": "string"
                        },
                        "source_lang": {
                          "type": "string"
                        },
                        "target_lang": {
                          "type": "string"
                        },
                        "tone": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/summarize": {
      "post": {
        "operationId": "summarize",
        "summary": "Document Summarization",
        "description": "Summarize long documents or text. Supports paragraph, bullets, TLDR, and structured JSON formats.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text to summarize"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "paragraph",
                      "bullets",
                      "tldr",
                      "structured"
                    ],
                    "default": "paragraph"
                  },
                  "max_length": {
                    "type": "integer",
                    "description": "Target word count",
                    "default": 300
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Summary result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "summary": {
                          "type": "string"
                        },
                        "key_points": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "format": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/extract": {
      "post": {
        "operationId": "extract",
        "summary": "Structured Data Extraction",
        "description": "Extract structured data from unstructured text. Define a schema and get JSON output.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text to extract data from"
                  },
                  "schema": {
                    "type": "object",
                    "description": "Expected output schema"
                  },
                  "instructions": {
                    "type": "string",
                    "description": "Additional extraction instructions"
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Extracted structured data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "extracted": {
                          "type": "object"
                        },
                        "confidence": {
                          "type": "number"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/analyze": {
      "post": {
        "operationId": "analyze",
        "summary": "Multimodal Analysis",
        "description": "Analyze images or audio with multimodal understanding.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "What to analyze"
                  },
                  "image_url": {
                    "type": "string",
                    "description": "Image URL"
                  },
                  "audio_url": {
                    "type": "string",
                    "description": "Audio URL"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Analysis result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "content": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "endpoint": {
                          "type": "string"
                        },
                        "price": {
                          "type": "string"
                        },
                        "has_image": {
                          "type": "boolean"
                        },
                        "has_audio": {
                          "type": "boolean"
                        },
                        "timestamp": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/search": {
      "post": {
        "operationId": "search",
        "summary": "Web Search + Synthesis",
        "description": "Search the web and get AI-synthesized answers.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "query": {
                    "type": "string",
                    "minLength": 1,
                    "description": "Search query"
                  }
                },
                "required": [
                  "query"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Search results with AI synthesis",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "query": {
                          "type": "string"
                        },
                        "answer": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/pipeline": {
      "post": {
        "operationId": "pipeline",
        "summary": "Multi-Step Pipeline",
        "description": "Chain up to 5 LLM steps in one request. Each step can use previous outputs.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "initial_input": {
                    "type": "string",
                    "description": "Input text for the pipeline"
                  },
                  "steps": {
                    "type": "array",
                    "maxItems": 5,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "prompt": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string",
                          "enum": [
                            "flash",
                            "pro",
                            "omni"
                          ]
                        },
                        "system": {
                          "type": "string"
                        },
                        "use_previous": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "prompt"
                      ]
                    }
                  }
                },
                "required": [
                  "steps"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pipeline results from all steps",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "object"
                        },
                        "final_output": {
                          "type": "string"
                        },
                        "steps_executed": {
                          "type": "integer"
                        },
                        "total_usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/batch": {
      "post": {
        "operationId": "batch",
        "summary": "Batch Processing",
        "description": "Process up to 10 inputs in one call. Supports sequential or concurrent execution.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.000000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "items": {
                    "type": "array",
                    "maxItems": 10,
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "prompt": {
                          "type": "string"
                        },
                        "system": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "prompt"
                      ]
                    }
                  },
                  "model": {
                    "type": "string",
                    "enum": [
                      "flash",
                      "pro",
                      "omni"
                    ],
                    "default": "flash"
                  },
                  "concurrent": {
                    "type": "boolean",
                    "default": false
                  }
                },
                "required": [
                  "items"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Batch results for all items",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "output": {
                                "type": "string"
                              },
                              "usage": {
                                "type": "object"
                              }
                            }
                          }
                        },
                        "items_processed": {
                          "type": "integer"
                        },
                        "total_usage": {
                          "type": "object"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/generate": {
      "post": {
        "operationId": "generate",
        "summary": "Structured Output Generation",
        "description": "Generate structured data in JSON, CSV, Markdown, HTML, or YAML format.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.050000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "What to generate"
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "json",
                      "csv",
                      "markdown",
                      "html",
                      "yaml"
                    ],
                    "default": "json"
                  },
                  "schema": {
                    "type": "object",
                    "description": "Expected output schema (for JSON)"
                  },
                  "examples": {
                    "type": "object",
                    "description": "Example output for reference"
                  }
                },
                "required": [
                  "prompt"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Generated structured output",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "output": {
                          "type": "string"
                        },
                        "format": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        },
                        "provider": {
                          "type": "string"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/rewrite": {
      "post": {
        "operationId": "rewrite",
        "summary": "Text Rewriting",
        "description": "Rewrite or paraphrase text with different styles: professional, casual, academic, creative, concise, expand, simplify, formal.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.020000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text to rewrite"
                  },
                  "style": {
                    "type": "string",
                    "enum": [
                      "professional",
                      "casual",
                      "academic",
                      "creative",
                      "concise",
                      "expand",
                      "simplify",
                      "formal"
                    ],
                    "default": "professional"
                  },
                  "tone": {
                    "type": "string",
                    "description": "Tone override"
                  },
                  "preserve_meaning": {
                    "type": "boolean",
                    "default": true
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rewritten text",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "original": {
                          "type": "string"
                        },
                        "rewritten": {
                          "type": "string"
                        },
                        "style": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        },
                        "provider": {
                          "type": "string"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/classify": {
      "post": {
        "operationId": "classify",
        "summary": "Text Classification",
        "description": "Classify text for sentiment, intent, toxicity, or language detection.",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.030000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text to classify"
                  },
                  "task": {
                    "type": "string",
                    "enum": [
                      "sentiment",
                      "classify",
                      "intent",
                      "toxicity",
                      "language"
                    ],
                    "default": "sentiment"
                  },
                  "categories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Categories for classification task"
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Classification result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "classification": {
                          "type": "object"
                        },
                        "task": {
                          "type": "string"
                        },
                        "model": {
                          "type": "string"
                        },
                        "usage": {
                          "type": "object"
                        },
                        "provider": {
                          "type": "string"
                        }
                      }
                    },
                    "meta": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    }
  }
}