# CortexCloud AI Chat Completion

> CortexCloud AI Chat Completion is a paid API for AI agents from api.cortexcloud.org, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-14).

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.

## Facts

- Endpoint: GET https://api.cortexcloud.org/v1/ai/chat
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/cortexcloud-ai-chat-completion-93a0ef65
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2QKy2s7hQLybTLrMxTmFD

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability cortexcloud-ai-chat-completion-93a0ef65
```

Example prompt: 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.

## When to prefer this

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).

## Known failure modes

- 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

## How this service works

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.

## Output

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).

## Request schema (JSON Schema)

```json
{
 "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
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "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
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/cortexcloud-ai-chat-completion-93a0ef65/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.cortexcloud.org](https://www.zero.xyz/host/api.cortexcloud.org/llms.txt)
