export type CreateApiApiToolsX402PricingCalculatorArgs = {body: {max_agent_price_usd?: number | undefined, monthly_infra_usd: number, retry_rate_percent?: number | undefined}}; export type CreateApiApiToolsX402PricingCalculatorOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Model a provider-side x402 per-call price * * POST /api/tools/x402-pricing-calculator */ export const createApiApiToolsX402PricingCalculator = async (args: CreateApiApiToolsX402PricingCalculatorArgs, options?: CreateApiApiToolsX402PricingCalculatorOptions) => { const {baseUrl = "https://ontarioprotocol.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/tools/x402-pricing-calculator${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };