# Chat Completions API (Llama 3.1 8B, x402)

> Chat Completions API (Llama 3.1 8B, x402) is a paid API for AI agents from golf-evm-math.x402-evm-math.workers.dev, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-31).

OpenAI-compatible chat completions endpoint running Llama 3.1 8B inference, billed per-call in USDC via x402 with no API key required.

## Facts

- Endpoint: POST https://golf-evm-math.x402-evm-math.workers.dev/v1/chat/completions?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chat-completions-api-llama-3-1-8b-x402-367aa44c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VyofPvR-8XLctoqgrRLoP

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 chat-completions-api-llama-3-1-8b-x402-367aa44c -d '<json body>'
```

Example prompt: Ask the Llama 3.1 8B model this question: 'What are three concise tips for writing better Python code?' — use the cheap pay-per-call inference endpoint, no API key needed.

## When to prefer this

Choose this endpoint when you need cheap, keyless LLM inference at $0.001/call and can accept Llama 3.1 8B quality output. Ideal for agent pipelines where sub-tasks need text generation at scale without managing API keys or subscriptions. Prefer over OpenAI or Anthropic APIs when cost minimization and pay-per-call micropayment (x402/USDC) billing are priorities, and when streaming is not required.

## Known failure modes

- Payment failure via x402 if USDC balance is insufficient or the x402 header is malformed
- Malformed request body (missing required 'messages' field) returns a 4xx error
- Model context length exceeded for very long conversation histories
- Cloudflare Worker timeout for unusually complex prompts
- No streaming support — clients expecting SSE will not receive incremental tokens

## How this service works

Exact EVM address, calldata, Uniswap V2/V3 and impermanent-loss math. Pay per call in USDC on Base via x402.

## Output

Returns a JSON object with a 'choices' array containing the assistant's reply message (role and content), plus a 'usage' object with token counts. No streaming — the full response is returned in one payload.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "properties": {}
    },
    "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"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "usage": {},
  "choices": [
   {
    "message": {
     "role": "assistant",
     "content": "Hi there, friend!"
    }
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chat-completions-api-llama-3-1-8b-x402-367aa44c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from golf-evm-math.x402-evm-math.workers.dev](https://www.zero.xyz/host/golf-evm-math.x402-evm-math.workers.dev/llms.txt)
