# CoinOpSelect Code Refactor Suggest API

> CoinOpSelect Code Refactor Suggest API is a paid API for AI agents from coinop.publicvm.com, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-21).

Accepts source code and returns AI-generated refactoring suggestions, paid per call via x402 on Base.

## Facts

- Endpoint: POST https://coinop.publicvm.com/api/v1/code/refactor-suggest?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-21
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/coinopselect-code-refactor-suggest-api-9a06d819
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8Qgx51U3EzodO6fuXU7Ws

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 coinopselect-code-refactor-suggest-api-9a06d819 -d '<json body>'
```

Example prompt: Can you suggest refactoring improvements for this code snippet: `function calcTotal(items) { let t = 0; for(let i=0;i<items.length;i++){t+=items[i].price;} return t; }`?

## When to prefer this

Choose this endpoint when you need quick, on-demand AI-powered refactoring suggestions for code snippets and are comfortable paying $0.01 USDC per call via x402 on Base. Suitable for agents embedded in developer workflows or CI pipelines that need programmatic code quality feedback without a subscription.

## Known failure modes

- Empty or missing source field returns empty result object
- Malformed JSON body returns HTTP 400
- Payment not provided or x402 handshake fails returns HTTP 402
- Very large code inputs may exceed processing limits
- Non-code text input may yield low-quality or generic suggestions

## How this service works

Paid on-chain token, wallet, contract and research data over x402 on Base.

## Output

Returns a JSON object containing refactoring suggestions and recommendations for the provided source code, typically including identified issues, proposed improvements, and potentially restructured code snippets.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "source": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "query": "refactor-suggest",
  "result": {}
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/coinopselect-code-refactor-suggest-api-9a06d819/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from coinop.publicvm.com](https://www.zero.xyz/host/coinop.publicvm.com/llms.txt)
