{"uid":"cap_Eb-B43x7Bj2H3x4G7gwTl","slug":"x402-ai-api-civicmerge-workers-dev-076d3aee","name":"CivicMerge x402 LLM Chat Completions","description":"LLM inference","url":"https://x402-ai-api.civicmerge.workers.dev/v1/chat/completions?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"model":{"enum":["llama-3.1-8b","granite-4.0","gpt-oss-20b","gemma-4-26b","qwen3-30b","kimi-k2.6","llama-3.3-70b","llama-4-scout","qwen-coder-32b","kimi-k2.5","qwq-32b","llama-3.2-11b-vision"],"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"max_tokens":{"type":"integer","default":500}}},"responseSchema":null,"example":{"request":{"model":"llama-3.1-8b","messages":[{"role":"user","content":"Explain the concept of machine learning in simple terms."}],"max_tokens":250},"response":{"id":"chatcmpl-aba333dc-998b-4681-993a-b0a838ebe74d","model":"@cf/meta/llama-3.1-8b-fast-v2","usage":{"total_tokens":296,"prompt_tokens":46,"completion_tokens":250,"prompt_tokens_details":{"cached_tokens":0}},"object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","audio":null,"content":"**What is Machine Learning?**\n\nMachine learning is a type of artificial intelligence (AI) that allows computers to learn from data without being explicitly programmed. It's like teaching a child to recognize objects, but instead of a child, it's a computer.\n\n**How Does it Work?**\n\nImagine you have a large collection of photos, and you want the computer to recognize pictures of dogs and cats. Here's how machine learning works:\n\n1. **Data Collection**: You gather a large dataset of labeled photos, where each photo is labeled as either a dog or a cat.\n2. **Model Training**: The computer uses this dataset to train a model, which is essentially a set of rules that the computer can use to make predictions.\n3. **Model Testing**: The computer tests the model on a new, unseen dataset to see how well it performs.\n4. **Model Improvement**: The computer adjusts the model based on the results, making it more accurate and efficient.\n\n**Types of Machine Learning**\n\nThere are three main types of machine learning:\n\n1. **Supervised Learning**: The computer is trained on labeled data, and it learns to make predictions based on that data.\n2. **Unsupervised Learning**: The computer is trained on unlabeled","refusal":null,"reasoning":null,"tool_calls":[],"annotations":null,"function_call":null},"logprobs":null,"token_ids":null,"stop_reason":null,"finish_reason":"length"}],"created":1781233101,"response":"**What is Machine Learning?**\n\nMachine learning is a type of artificial intelligence (AI) that allows computers to learn from data without being explicitly programmed. It's like teaching a child to recognize objects, but instead of a child, it's a computer.\n\n**How Does it Work?**\n\nImagine you have a large collection of photos, and you want the computer to recognize pictures of dogs and cats. Here's how machine learning works:\n\n1. **Data Collection**: You gather a large dataset of labeled photos, where each photo is labeled as either a dog or a cat.\n2. **Model Training**: The computer uses this dataset to train a model, which is essentially a set of rules that the computer can use to make predictions.\n3. **Model Testing**: The computer tests the model on a new, unseen dataset to see how well it performs.\n4. **Model Improvement**: The computer adjusts the model based on the results, making it more accurate and efficient.\n\n**Types of Machine Learning**\n\nThere are three main types of machine learning:\n\n1. **Supervised Learning**: The computer is trained on labeled data, and it learns to make predictions based on that data.\n2. **Unsupervised Learning**: The computer is trained on unlabeled","tool_calls":[],"service_tier":null,"prompt_logprobs":null,"prompt_token_ids":null,"kv_transfer_params":null,"system_fingerprint":null}},"exampleRequest":{"model":"llama-3.1-8b","messages":[{"role":"user","content":"Explain the concept of machine learning in simple terms."}],"max_tokens":250},"tags":["x402"],"displayCostAmount":"0.03","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":2,"rating":{"score":"0.04","successRate":"0.60","reviews":2,"stars":"1.2","state":"rated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.03/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.03","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.03","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_6QsThbs72pTccOUY59wNj","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.03","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Pay-per-call LLM inference endpoint supporting multiple open-source models via an OpenAI-compatible chat completions API, billed at $0.03 USDC per request using the x402 payment protocol.","exampleAgentPrompt":"Ask the llama-3.3-70b model: 'What are the three most important factors in building a reliable distributed system?' and limit the response to 300 tokens.","exampleUseCases":[{"title":"Real-time customer support response generation","prompt":"Use the qwen model to draft a professional response to this angry customer email about a delayed shipment. Keep it under 200 tokens and make sure it sounds empathetic."},{"title":"Code explanation and debugging assistance","prompt":"Ask granite to explain what's wrong with this Python function and suggest a fix. I need it to be clear enough for a junior developer to understand."},{"title":"Quick content summarization for newsletters","prompt":"Have Llama summarize this 5-minute podcast transcript into 3 bullet points for our weekly tech newsletter. Make it punchy and under 150 tokens."}],"resultDescription":"An OpenAI-compatible chat completion object containing the assistant's generated reply, finish reason, token usage statistics, and model metadata.","failureModes":["Payment not included or invalid x402 payment header — 402 Payment Required","Unknown or unsupported model name passed in the enum — 400 Bad Request","Messages array malformed or missing required role/content fields — 400 validation error","Max tokens exceeded for model context window — error or truncated response","Cloudflare Worker timeout for very long completions — 524 timeout","Insufficient USDC balance for x402 payment — payment failure"],"whenToPreferThis":"Choose this endpoint when you need pay-per-call LLM inference without a subscription, want access to a variety of open-weight models (Llama, Qwen, Gemma, Granite, Kimi) via a familiar OpenAI-compatible interface, and are operating in an x402-enabled agentic payment environment where micropayments per call are acceptable.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":10,"lastUsedAt":"2026-07-17T22:38:10.197Z","lastSuccessfullyRanAt":"2026-07-17T20:08:16.932Z","lastHealthCheckAt":"2026-10-23T08:10:17.254Z","isFirstParty":false,"canonicalSlug":"x402-ai-api-civicmerge-workers-dev-076d3aee"}