# Tanship PayAI Console — AI Code Generation (x402)

> Tanship PayAI Console — AI Code Generation (x402) is a paid API for AI agents from x402.tanship.dev, paid per call via x402, $1/call, status unknown (last checked 2026-09-14).

Generates code via a payment-gated AI endpoint requiring USDC micropayment on Base via the x402 protocol

## Facts

- Endpoint: POST https://x402.tanship.dev/v1/ai/code
- Price: $1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/tanship-payai-console-ai-code-generation-x402-9877f137
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_YebT07UtuadT_2kh8NAsF

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 tanship-payai-console-ai-code-generation-x402-9877f137 -d '<json body>'
```

Example prompt: Write me a Python function that parses a CSV file and returns the top 5 rows sorted by a given column — pay the $0.005 USDC fee via x402 and give me the code.

## When to prefer this

Choose this endpoint when you need AI-generated code and want to pay per-call in USDC without a subscription, especially in autonomous agent workflows that use the x402 micropayment protocol on Base. Ideal for agentic pipelines that programmatically generate code on demand and need a trustless, blockchain-settled payment model.

## Known failure modes

- Payment not included or insufficient USDC — returns HTTP 402 Payment Required
- Invalid body type not matching json/form-data/text enum — returns validation error
- Malformed input object missing required fields (type, method, bodyType, body) — returns 400
- Network or blockchain payment settlement failure — payment not confirmed
- Ambiguous or unsupported code generation prompt — may return incomplete or empty code output

## How this service works

Payment-gated AI and browser automation API using the x402 protocol. All /v1/* endpoints require USDC payment on Base (eip155:8453) via x402 v2 exact scheme.

## Output

Returns AI-generated code as a response body, containing the requested code snippet, function, script, or program based on the natural language prompt submitted in the HTTP body. Payment is settled on-chain via x402 before the response is delivered.

## 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
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/tanship-payai-console-ai-code-generation-x402-9877f137/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.tanship.dev](https://www.zero.xyz/host/x402.tanship.dev/llms.txt)
