# Bitcoin Benji AI Code Generation

> Bitcoin Benji AI Code Generation is a paid API for AI agents from api.bitcoinbenji.com, paid per call via x402, $0.04/call, status unknown (last checked 2026-09-15).

Generates code snippets or scripts on demand via a pay-per-call Lightning-native AI inference endpoint, gated by L402 micropayments.

## Facts

- Endpoint: POST https://api.bitcoinbenji.com/ai/code-generate
- Price: $0.04/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bitcoin-benji-ai-code-generation-9f1b7d83
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_HoA0qA-tz4z6P3le8oocE

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 bitcoin-benji-ai-code-generation-9f1b7d83 -d '<json body>'
```

Example prompt: Write me a Python function that connects to a Bitcoin Lightning node, checks the channel balance, and returns it as a dictionary — pay for it with a Lightning micropayment.

## When to prefer this

Choose this endpoint when you need pay-per-call AI code generation without API keys or subscriptions, especially in Bitcoin/Lightning-native agentic workflows where micropayments via L402 are already part of the stack. Ideal for agents that need to generate code on demand without committing to a monthly subscription to a traditional AI provider.

## Known failure modes

- Payment not provided or Lightning invoice expired — returns HTTP 402 with a new invoice
- Malformed or missing prompt in request body — returns 400 Bad Request
- AI inference backend unavailable — returns 503 Service Unavailable
- Generated code may be incorrect or incomplete for complex tasks
- Rate limits or quota exceeded on the underlying AI provider

## How this service works

L402-gated APIs: real-time Bitcoin mempool intelligence and private AI inference. Pay-per-call via Lightning. Zero API keys. Zero subscriptions.

## Output

A JSON response containing AI-generated code based on the provided prompt, returned after successful L402 Lightning payment verification. Typically includes the generated code as a string, potentially with metadata about the generation.

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bitcoin-benji-ai-code-generation-9f1b7d83/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.bitcoinbenji.com](https://www.zero.xyz/host/api.bitcoinbenji.com/llms.txt)
