{"uid":"cap_WnrFkAKwRodn0wjTs7UBs","slug":"quickbuild-llm-chat-completions-8e4c3944","name":"QuickBuild LLM Chat Completions","description":"Landing pages ($15), Google Sheets/Apps Script automation ($10), scrapers, scripts & Telegram bots (from $15), broken-link + sitemap audit reports ($10). See a working demo first, pay after.","url":"https://quickbuild.quynguyenbac.workers.dev/v1/chat/completions?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":[],"properties":{"seed":{"type":"integer","description":"Optional seed."},"model":{"enum":["llama-3.1-8b","llama-3.2-3b","llama-3.2-1b","mistral-7b","granite-4.0-micro","@cf/meta/llama-3.1-8b-instruct-fp8-fast","@cf/meta/llama-3.2-3b-instruct","@cf/meta/llama-3.2-1b-instruct","@cf/mistral/mistral-7b-instruct-v0.1","@cf/ibm-granite/granite-4.0-h-micro"],"type":"string","description":"Model alias or Workers AI id (default llama-3.1-8b). Unknown names fall back to the default."},"top_p":{"type":"number","maximum":1,"minimum":0,"description":"Nucleus sampling."},"prompt":{"type":"string","description":"Convenience: a single user message (appended after `messages`)."},"stream":{"type":"boolean","description":"If true, returns text/event-stream chat.completion.chunk events (whole answer in one chunk) ending with [DONE]."},"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","developer","user","assistant"],"type":"string"},"content":{"type":"string"}}},"description":"OpenAI-style chat messages. Optional: if omitted, `prompt` (or a sample question) is used."},"max_tokens":{"type":"integer","maximum":512,"minimum":1,"description":"Max completion tokens (default and cap 512)."},"temperature":{"type":"number","maximum":2,"minimum":0,"description":"Sampling temperature (model default if omitted)."},"response_format":{"type":"object","description":"{\"type\":\"json_object\"} or {\"type\":\"json_schema\",\"json_schema\":{\"schema\":{...}}}."}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"id":{"type":"string"},"model":{"type":"string"},"usage":{"type":"object","properties":{"total_tokens":{"type":"integer"},"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"}}},"object":{"type":"string"},"choices":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"message":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}},"finish_reason":{"type":"string"}}}},"created":{"type":"integer"}}}}}}},"responseSchema":{"type":"json","example":{"id":"chatcmpl-3f2a9c","model":"@cf/meta/llama-3.1-8b-instruct-fp8-fast","usage":{"total_tokens":49,"prompt_tokens":22,"completion_tokens":27},"object":"chat.completion","choices":[{"index":0,"message":{"role":"assistant","content":"HTTP 402 Payment Required means the server wants payment before it will serve the requested resource."},"finish_reason":"stop"}],"created":1792526400}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_XiqmQnku4NwPVjb7Ai_2s","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs a prompt or chat message history through a hosted open-source LLM (Llama, Mistral, or Granite) and returns an OpenAI-compatible chat completion response","exampleAgentPrompt":"Ask the llama-3.1-8b model: 'Explain what HTTP 402 Payment Required means in one sentence' — up to 100 tokens, with temperature 0.7.","exampleUseCases":[{"title":"Micro-task text summarization","prompt":"Use the llama-3.2-3b model to summarize this paragraph in two sentences, keep it under 100 tokens: 'Cloudflare Workers run serverless code at the edge, close to users worldwide, with low latency and automatic scaling without managing servers.'"},{"title":"Structured JSON extraction from prose","prompt":"Send this to the Llama 3.1 8B model with response_format set to json_object: 'Extract the name, date, and amount from this invoice text: John Doe, invoice dated March 15 2025, total $4,200.'"},{"title":"System-prompted customer FAQ bot","prompt":"Call the mistral-7b model with a system message saying 'You are a concise customer support agent for a SaaS product' and a user message asking 'How do I reset my password?' — cap it at 200 tokens."}],"resultDescription":"An OpenAI-compatible chat.completion JSON object containing the assistant's reply text, the model used, token counts (prompt, completion, total), a finish_reason, and a unique completion ID. When stream=true, returns server-sent events with chat.completion.chunk objects ending with [DONE].","failureModes":["Unknown model name falls back silently to default llama-3.1-8b rather than erroring","max_tokens hard-capped at 512 — requests for longer outputs are silently truncated","Missing payment header (x402) returns HTTP 402 before inference runs","Prompt or messages array omitted — falls back to a built-in sample question rather than erroring","Stream mode delivers the full answer in one chunk, not token-by-token, despite SSE framing"],"whenToPreferThis":"Choose this endpoint when you need cheap ($0.003/call), OpenAI-compatible LLM inference on small open-source models (Llama, Mistral, Granite) without managing infrastructure, especially for micro-tasks where GPT-4-class capability is unnecessary. Prefer it over heavier LLM APIs when cost and compatibility matter more than frontier-model quality, and when a 512-token output cap is acceptable.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:20:48.428Z","isFirstParty":false,"canonicalSlug":"quickbuild-llm-chat-completions-8e4c3944"}