{"service":"kas402","version":"v0.9.1-5-g4d7ea7e","description":"Pay-per-call APIs for AI agents. Speech, image, search, scraping, chat — pay per call with USDC (x402) or Lightning (L402), or use prepaid balance with API keys.","base_url":"https://kas402.com","discovery":"/.well-known/x402","quick_start":{"1_send_request":"POST to any endpoint with your request body (e.g. POST /api/v1/image/generate with {\"prompt\":\"a cat\"})","2_get_402":"Server returns HTTP 402 with X-PAYMENT-REQUIRED header containing base64-encoded JSON: {x402Version, accepts: [{scheme, network, maxAmountRequired, resource, payTo, maxTimeoutSeconds, asset, extra}]}","3_sign_payment":"Sign a USDC transfer for maxAmountRequired to the payTo address on the specified network. Encode the signed payment as base64.","4_retry_with_payment":"Retry the same request with header: X-PAYMENT: \u003cbase64-encoded-signed-payment\u003e","5_get_result":"Server returns 202 with {job_id, status, poll} for async endpoints, or 200 with result for sync endpoints","6_poll_async":"For async: poll GET /api/v1/jobs/{job_id} every 2-3s until status=completed, then use payload_url","library":"npm install @x402/fetch — handles steps 2-4 automatically. Use wrapFetchWithPayment(fetch, x402Client) then call endpoints normally.","accounts":"Alternative: create a prepaid balance account via EVM wallet challenge/verify, top up with x402, then use an API key (Authorization: Bearer kas_live_...) for all endpoints including chat.","testnet":"Use Base Sepolia testnet. Get free USDC: curl -X POST /api/v1/faucet -d '{\"address\":\"0xYOUR_WALLET\"}'. Fallback: faucet.circle.com"},"payment":{"protocols":["x402 (USDC)","l402 (Lightning)"],"networks":["Base","Solana","Polygon","Avalanche"],"flow":"POST → 402 → sign payment → retry with X-PAYMENT header → 202 + job_id → poll /jobs/{id}","l402_enabled":true},"accounts":{"description":"Prepaid balance accounts. Top up with USDC (x402), then spend on any endpoint including chat.","identity":"evm","auth":"Authorization: Bearer kas_live_...","endpoints":{"account":"GET /api/v1/account","api_keys":"POST/GET/DELETE /api/v1/api-keys","challenge":"POST /api/v1/account/challenge","jobs":"GET /api/v1/account/jobs","ledger":"GET /api/v1/account/ledger","topup":"POST /api/v1/topups (x402 paywall, requires API key, min $1.00)","verify":"POST /api/v1/account/verify"},"bootstrap_flow":"POST /api/v1/account/challenge with {rail: x402_usdc, identity_kind: evm, chain: eip155:8453, address: 0x..., action: bootstrap} → sign returned message with EVM wallet → POST /api/v1/account/verify with {challenge_id, signature} → returns api_key","recover_flow":"Same as bootstrap with action=recover_api_key — revokes all existing keys, issues new one"},"chat":{"description":"OpenAI-compatible chat completions. Balance-only, requires API key.","endpoint":"POST /api/v1/chat/completions","models":"GET /api/v1/models","auth":"Authorization: Bearer kas_live_...","billing":"Deducted from prepaid balance based on actual token usage","available_models":[{"id":"gpt-4.1-nano","input_per_1m":0.13,"max_context":1048576,"output_per_1m":0.52,"provider":"openai"},{"id":"gpt-4.1-mini","input_per_1m":0.52,"max_context":1048576,"output_per_1m":2.08,"provider":"openai"},{"id":"gpt-4.1","input_per_1m":2.6,"max_context":1048576,"output_per_1m":10.4,"provider":"openai"},{"id":"gpt-5.4-nano","input_per_1m":0.26,"max_context":1048576,"output_per_1m":1.63,"provider":"openai"},{"id":"gpt-5.4-mini","input_per_1m":0.98,"max_context":1048576,"output_per_1m":5.85,"provider":"openai"},{"id":"gpt-5.4","input_per_1m":3.25,"max_context":1048576,"output_per_1m":19.5,"provider":"openai"},{"id":"claude-haiku-4.5","input_per_1m":1.3,"max_context":200000,"output_per_1m":6.5,"provider":"anthropic"},{"id":"claude-sonnet-4.6","input_per_1m":3.9,"max_context":1000000,"output_per_1m":19.5,"provider":"anthropic"},{"id":"claude-opus-4.6","input_per_1m":6.5,"max_context":1000000,"output_per_1m":32.5,"provider":"anthropic"}]},"endpoints":[{"body":{"language":"ISO code","provider":"deepgram|openai|elevenlabs","text":"string, required","voice":"string (default: thalia)"},"description":"Text-to-speech via Deepgram Aura-2, OpenAI gpt-4o-mini-tts, or ElevenLabs","method":"POST","path":"/api/v1/speech/speak","pricing":"$0.05/1K chars, min $0.005","result":"MP3 URL (valid 30 days)","type":"async"},{"body":{"language":"ISO code","provider":"deepgram|openai","url":"string, required (or binary audio)"},"description":"Speech-to-text via Deepgram Nova-3 or OpenAI gpt-4o-transcribe","method":"POST","path":"/api/v1/speech/listen","pricing":"$0.03/MB, min $0.005, max 25MB","result":"JSON transcript with timestamps","type":"async"},{"body":{"aspect_ratio":"e.g. 1:1, 16:9","prompt":"string, required","provider":"nano-banana|nano-banana-2|nano-banana-pro|stability|stability-ultra|openai","transparent":"bool, OpenAI only"},"description":"Image generation from text prompt","method":"POST","path":"/api/v1/image/generate","pricing":{"nano-banana":"$0.05","nano-banana-2":"$0.10","nano-banana-pro":"$0.20","openai":"$0.05","stability":"$0.05","stability-ultra":"$0.12"},"result":"PNG URL (valid 30 days)","type":"async"},{"body":{"image_url":"string, required (or multipart image file)","prompt":"string, required","provider":"nano-banana|nano-banana-2|nano-banana-pro|openai"},"description":"Edit image with text prompt (multipart or JSON with image_url)","method":"POST","path":"/api/v1/image/edit","pricing":{"nano-banana":"$0.07","nano-banana-2":"$0.12","nano-banana-pro":"$0.22","openai":"$0.08"},"result":"PNG URL (valid 30 days), max upload 10MB","type":"async"},{"body":{"messages":"[{role,content}], required","system_prompt":"string, optional"},"description":"Web search via Perplexity Sonar with citations","method":"POST","path":"/api/v1/search","result":"JSON with content, citations, model","type":"sync","variants":{"/search":"$0.03 (sonar)","/search/pro":"$0.08 (sonar-pro)","/search/reason":"$0.05 (sonar-reasoning-pro)","/search/research":"$0.15 (sonar-deep-research)"}},{"body":{"url":"string, required (http:// or https://)"},"description":"Web scraping via Zyte extraction API","method":"POST","path":"/api/v1/scrape/*","result":"JSON with extracted data","type":"sync","variants":{"/scrape/article":"$0.015","/scrape/headlines":"$0.015","/scrape/html":"$0.010","/scrape/product":"$0.015"}},{"body":{"address":"0x... EVM wallet address"},"description":"Get free testnet USDC (Base Sepolia). Rate limited per wallet and IP.","method":"POST","path":"/api/v1/faucet","result":"tx_hash, amount, explorer link","type":"free"},{"description":"Poll async job status. Returns payload_url when completed.","method":"GET","path":"/api/v1/jobs/{id}","polling":"every 2-3s, most jobs complete in 5-15s","type":"free"}],"aspect_ratios":["16:9","1:1","21:9","2:3","3:2","3:4","4:3","4:5","5:4","9:16","9:21"],"voices":{"deepgram":["amalthea","andromeda","apollo","arcas","aries","asteria","athena","atlas","aurora","callista","cora","cordelia","delia","draco","electra","harmonia","helena","hera","hermes","hyperion","iris","janus","juno","jupiter","luna","mars","minerva","neptune","odysseus","ophelia","orion","orpheus","pandora","phoebe","pluto","saturn","selene","thalia","theia","vesta","zeus"],"deepgram_default":"thalia","openai":["alloy","ash","ballad","cedar","coral","echo","fable","marin","nova","onyx","sage","shimmer","verse"],"openai_default":"coral","elevenlabs":["alice","antoni","aria","arnold","bill","brian","callum","charlie","charlotte","chris","clyde","daniel","dave","domi","dorothy","drew","elli","emily","fin","george","harry","james","jessica","josh","laura","liam","lily","matilda","nicole","patrick","paul","rachel","river","roger","sarah","thomas","will"],"elevenlabs_default":"aria"},"retention_days":30}
