{"uid":"cap_2QKy2s7hQLybTLrMxTmFD","slug":"cortexcloud-ai-chat-completion-93a0ef65","name":"CortexCloud AI Chat Completion","description":"One pay-per-call API for AI agents: optimization, AI, research, on-chain data, and automation — all settled in USDC on Base via x402. Discover via MCP and Bazaar, estimate free, pay per call. No API keys, no signup.","url":"https://api.cortexcloud.org/v1/ai/chat","method":"GET","headers":{},"bodySchema":{"type":"object","properties":{"model":{"enum":["gemini-2.5-flash","gemini-2.0-flash","gpt-4o-mini"],"type":"string","default":"gemini-2.5-flash"},"messages":{"type":"array","items":{"type":"object"},"minItems":1},"max_tokens":{"type":"integer","default":512,"maximum":8192,"minimum":1},"temperature":{"type":"number","default":0.7,"maximum":2,"minimum":0}}},"responseSchema":{"type":"object","format":"application/json","example":{"id":"chatcmpl-...","model":"openrouter/gemini-2.5-flash","usage":{"prompt_tokens":12,"completion_tokens":48},"choices":[{"message":{"role":"assistant","content":"..."}}],"price_usd":0.0082}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","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.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_NB04vONVrshEPVa4jOhOB","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Sends a chat message array to Gemini or GPT-4o-mini via OpenRouter and returns an AI-generated text response, paid per-call in USDC on Base via x402.","exampleAgentPrompt":"Using gemini-2.5-flash, send this conversation to the AI chat endpoint with a max of 1024 tokens and temperature 0.7: system message 'You are a helpful assistant', user message 'Explain the concept of zero-knowledge proofs in two paragraphs' — pay with USDC on Base.","exampleUseCases":[{"title":"Agent reasoning step via Gemini","prompt":"Run a reasoning step for my agent using gemini-2.5-flash: system prompt is 'You are a concise decision-making assistant', user message is 'Should I retry a failed API call after a 429 error? Give a one-sentence answer.' Set max tokens to 256 and temperature to 0.3."},{"title":"Customer support draft generation","prompt":"Generate a customer support reply using gpt-4o-mini — system: 'You are a friendly support agent for a SaaS product', user: 'I can't log in and my reset email never arrived.' Keep it under 300 tokens and use a temperature of 0.5."},{"title":"Creative writing with Gemini Flash","prompt":"Use gemini-2.0-flash to write a short opening paragraph for a sci-fi story. System prompt: 'You are a creative fiction writer.' User message: 'Write an opening for a story about a colony ship that loses contact with Earth.' Max tokens 512, temperature 1.2."}],"resultDescription":"Returns an OpenAI-compatible chat completion response object containing the assistant's generated message text, finish reason, and token usage statistics (prompt tokens, completion tokens, total tokens).","failureModes":["Payment failure (x402 USDC transaction rejected or insufficient balance) — returns 402 Payment Required","Invalid model name not in enum — returns 400 Bad Request","messages array empty or missing — returns 400 validation error","max_tokens exceeds 8192 — returns 400 out-of-range error","Upstream OpenRouter/model unavailability — returns 503 or 502","Temperature out of range 0–2 — returns 400 validation error"],"whenToPreferThis":"Choose this endpoint when you need pay-per-call LLM chat completion with no API key setup, especially in autonomous agent pipelines that already handle x402 USDC payments on Base. It is ideal for agents that want to avoid managing multiple provider credentials and prefer a single crypto-native billing interface. Prefer it when you want access to both Gemini 2.5 Flash and GPT-4o-mini through one consistent API surface at low per-call cost ($0.004 USDC).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:31:47.862Z","isFirstParty":false}