{"uid":"cap_UcN3v-pEYUrDR3M_sTgU4","slug":"x402-gateway-llm-chat-completion-ibm-granite-4-0-micro-5c203978","name":"x402-gateway LLM Chat Completion (IBM Granite 4.0 Micro)","description":"Use when you need an llm chat completion for summaries, extraction or classification from a cheap open model. Do not use for frontier models, tool calling or streaming. Returns JSON with a chat completion from IBM Granite 4.0 Micro on Workers AI, with token usage for 0.002 USDC per thousand tokens, up to 0.03 USDC per call (clients without upto pay the cap). Asynchronous: the paid call returns a jobId and a free pollUrl; typical job time 8000 ms (p95). Category: Inference.","url":"https://x402-gateway.blackwoodstate8.workers.dev/v1/llm-chat?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"type":"object","required":["role","content"],"properties":{"role":{"enum":["system","user","assistant"],"type":"string","description":"Who wrote the message"},"content":{"type":"string","maxLength":32000,"minLength":1,"description":"Message text"}}},"maxItems":50,"minItems":1,"description":"Conversation so far, oldest first, e.g. [{\"role\": \"user\", \"content\": \"Summarize: ...\"}]"},"maxTokens":{"type":"integer","maximum":4096,"minimum":1,"description":"Maximum tokens to generate (1-4096, 512 when omitted); billed as requested"},"temperature":{"type":"number","maximum":2,"minimum":0,"description":"Sampling temperature (0-2), e.g. 0.2 for near-deterministic output"}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["jobId","pollUrl","expiresAt","status"],"properties":{"next":{"type":"object","required":["service","tool","method","url","useWhen","sample"],"properties":{"url":{"type":"string","description":"Paid route of the next call"},"tool":{"type":"string","description":"MCP tool name of the same call"},"method":{"enum":["GET","POST"],"type":"string"},"sample":{"type":"string","description":"Free fixed sample of the whole family"},"service":{"type":"string","description":"Service id of the suggested next paid call"},"useWhen":{"type":"string","description":"When the next call is the right one"}},"description":"Suggested next paid call in the same family (call it in a loop when the task continues)","additionalProperties":false},"jobId":{"type":"string","maxLength":100,"minLength":1},"status":{"type":"string","const":"queued"},"pollUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","description":"ISO 8601: depois disso o resultado deixa de existir"}},"additionalProperties":false}}}}},"responseSchema":{"type":"json","example":{"jobId":"job_00000000000000000000000000000000","status":"queued","pollUrl":"https://gateway.example/v1/llm-chat/jobs/job_00000000000000000000000000000000","expiresAt":"2026-01-31T00:00:00.000Z"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.03","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","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.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_gC69H_xABzun0KyK9gVF5","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.03","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Runs an asynchronous LLM chat completion using IBM Granite 4.0 Micro on Workers AI, returning a jobId and pollUrl for lightweight tasks like summarization, extraction, and classification.","exampleAgentPrompt":"Use the cheap Granite model to classify this customer review as positive, negative, or neutral — here's the review: 'Shipping was fast but the product broke after two days.' Keep temperature at 0.1 and limit the response to 50 tokens.","exampleUseCases":[{"title":"Classify support tickets by category","prompt":"I have a batch of support tickets I need categorized — can you use the inexpensive Granite model to classify this one as billing, technical, or general inquiry: 'My invoice shows a charge I don't recognize from last month.' Use temperature 0.1 and cap output at 100 tokens."},{"title":"Extract key fields from job posting","prompt":"Pull out the job title, required skills, and salary range from this job listing text using the budget LLM: 'Senior Backend Engineer at Acme Corp, 5+ years Go experience required, $150k-$180k.' Keep it near-deterministic with temperature 0.2 and max 200 tokens."},{"title":"Summarize meeting transcript","prompt":"Summarize this meeting transcript into 3 bullet points using the affordable Granite model — the transcript is: 'We discussed Q3 targets, agreed to hire two engineers, and postponed the product launch to October.' Set max tokens to 150 and temperature to 0.3."}],"resultDescription":"An asynchronous job response containing a jobId, a pollUrl to check status, an expiresAt timestamp, and a status field. After polling, the final result includes the chat completion text from IBM Granite 4.0 Micro, token usage counts, and a 'next' field suggesting the next call in the same family for chaining.","failureModes":["Messages array missing or empty — returns validation error","Content exceeds 32,000 character limit per message — returns schema error","maxTokens set above 4096 — rejected by schema validation","Poll URL expires before the job is retrieved — result unavailable","Workers AI backend unavailable — job may fail or timeout beyond p95 8000ms","Temperature outside 0-2 range — rejected by schema","Payment not completed via x402 — call not initiated"],"whenToPreferThis":"Choose this endpoint when you need fast, cheap text inference for summarization, classification, or extraction tasks and do not need frontier model quality, tool calling, or streaming. It is ideal for high-volume, cost-sensitive pipelines where IBM Granite 4.0 Micro's capability is sufficient. Avoid it for complex reasoning, multi-step tool use, code generation requiring high accuracy, or tasks needing real-time streaming responses.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-23T00:52:18.668Z","isFirstParty":false,"canonicalSlug":"x402-gateway-llm-chat-completion-ibm-granite-4-0-micro-5c203978"}