{
    "openapi": "3.1.0",
    "info": {
        "title": "Compacthost AI Tools",
        "version": "1.0.0",
        "description": "Pay-per-call generative AI tools for autonomous agents, settled in USDC on Base via x402.",
        "x-guidance": "Call any operation without payment to receive a 402 with exact payment requirements. Pay only after a successful generation is guaranteed \u2014 settlement happens after the work completes, so a failed job never charges you.",
        "contact": {
            "email": "keith@compacthost.com"
        }
    },
    "paths": {
        "/music": {
            "post": {
                "operationId": "music",
                "summary": "Generate a full song from a text prompt",
                "tags": [
                    "Music"
                ],
                "x-payment-info": {
                    "price": {
                        "mode": "fixed",
                        "currency": "USD",
                        "amount": "0.100000"
                    },
                    "protocols": [
                        {
                            "x402": {}
                        }
                    ]
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "prompt"
                                ],
                                "properties": {
                                    "prompt": {
                                        "type": "string",
                                        "description": "Style/mood description"
                                    },
                                    "lyrics": {
                                        "type": "string",
                                        "description": "Optional song lyrics"
                                    },
                                    "duration": {
                                        "type": "number",
                                        "description": "Seconds, 15-240, default 60"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "audio/mpeg": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Payment Required"
                    }
                }
            }
        },
        "/image": {
            "post": {
                "operationId": "image",
                "summary": "Generate an image from a text prompt",
                "tags": [
                    "Image"
                ],
                "x-payment-info": {
                    "price": {
                        "mode": "fixed",
                        "currency": "USD",
                        "amount": "0.050000"
                    },
                    "protocols": [
                        {
                            "x402": {}
                        }
                    ]
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "prompt"
                                ],
                                "properties": {
                                    "prompt": {
                                        "type": "string"
                                    },
                                    "size": {
                                        "type": "string",
                                        "description": "WxH, default 1024x1024"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "image/png": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Payment Required"
                    }
                }
            }
        },
        "/kontext": {
            "post": {
                "operationId": "kontext",
                "summary": "Edit a photo from a text instruction + reference image",
                "tags": [
                    "Image"
                ],
                "x-payment-info": {
                    "price": {
                        "mode": "fixed",
                        "currency": "USD",
                        "amount": "0.030000"
                    },
                    "protocols": [
                        {
                            "x402": {}
                        }
                    ]
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "prompt",
                                    "reference_image"
                                ],
                                "properties": {
                                    "prompt": {
                                        "type": "string",
                                        "description": "What to change"
                                    },
                                    "reference_image": {
                                        "type": "string",
                                        "description": "Base64-encoded source photo, max ~10MB"
                                    },
                                    "size": {
                                        "type": "string",
                                        "description": "WxH, default 832x1216"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "image/png": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Payment Required"
                    }
                }
            }
        },
        "/search": {
            "post": {
                "operationId": "search",
                "summary": "Web search (general/tech/health/scholarly/news)",
                "tags": [
                    "Data"
                ],
                "x-payment-info": {
                    "price": {
                        "mode": "fixed",
                        "currency": "USD",
                        "amount": "0.002000"
                    },
                    "protocols": [
                        {
                            "x402": {}
                        }
                    ]
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "query"
                                ],
                                "properties": {
                                    "query": {
                                        "type": "string"
                                    },
                                    "tab": {
                                        "type": "string",
                                        "description": "general|tech|health|scholarly|news, default general"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "results": {
                                            "type": "array"
                                        },
                                        "total": {
                                            "type": "integer"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Payment Required"
                    }
                }
            }
        },
        "/weather": {
            "post": {
                "operationId": "weather",
                "summary": "Current conditions + 5-day forecast for a location",
                "tags": [
                    "Data"
                ],
                "x-payment-info": {
                    "price": {
                        "mode": "fixed",
                        "currency": "USD",
                        "amount": "0.002000"
                    },
                    "protocols": [
                        {
                            "x402": {}
                        }
                    ]
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "location"
                                ],
                                "properties": {
                                    "location": {
                                        "type": "string",
                                        "description": "Place name, e.g. 'Denver, CO'"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "location": {
                                            "type": "string"
                                        },
                                        "lat": {
                                            "type": "number"
                                        },
                                        "lon": {
                                            "type": "number"
                                        },
                                        "current": {
                                            "type": "object"
                                        },
                                        "daily": {
                                            "type": "object"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Payment Required"
                    }
                }
            }
        },
        "/geocode": {
            "post": {
                "operationId": "geocode",
                "summary": "Geocode a place name to latitude/longitude",
                "tags": [
                    "Data"
                ],
                "x-payment-info": {
                    "price": {
                        "mode": "fixed",
                        "currency": "USD",
                        "amount": "0.001000"
                    },
                    "protocols": [
                        {
                            "x402": {}
                        }
                    ]
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "location"
                                ],
                                "properties": {
                                    "location": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "lat": {
                                            "type": "number"
                                        },
                                        "lon": {
                                            "type": "number"
                                        },
                                        "name": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "402": {
                        "description": "Payment Required"
                    }
                }
            }
        }
    }
}