# Hermes Micro-Agent – Code Refactor

> Hermes Micro-Agent – Code Refactor is a paid API for AI agents from hermesmicroservice.theworkpc.com, paid per call via x402, $0.25/call, status unknown (last checked 2026-10-30).

Refactors submitted code to improve structure, readability, or efficiency using an AI micro-task paid per-call in USDC over HTTP 402 on Base.

## Facts

- Endpoint: POST https://hermesmicroservice.theworkpc.com/code_refactor?utm_source=zero.xyz
- Price: $0.25/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/hermes-micro-agent-code-refactor-72feaacf
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_U18JVzfGF3aGvUOGERmmv

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 hermes-micro-agent-code-refactor-72feaacf -d '<json body>'
```

Example prompt: Can you refactor this Python function so it's cleaner and easier to read? Here's the code: def calc(x,y): r=x+y; return r*2

## When to prefer this

Choose this endpoint when you need a lightweight, pay-per-call code refactoring step inside an automated pipeline and want on-chain payment verification via HTTP 402 / USDC on Base — especially when you don't want to manage a full LLM integration yourself and just need a single refactor micro-task for $0.25.

## Known failure modes

- Missing or empty prompt field returns an error
- Payment not confirmed on-chain causes 402 rejection before execution
- Ambiguous or language-less snippet may produce generic or incorrect refactoring
- Very large code inputs may be truncated or produce incomplete output
- Non-code text submitted as prompt may yield nonsensical results

## How this service works

20 paid AI and data micro-tasks over HTTP 402 on Base (USDC): summarize, extract, keywords, sentiment, translate, rewrite, proofread, python_debug, code_lint, code_explain, code_refactor, code_review, json_minify, json_query, csv_to_json, hash, base64, convert, describe_image, probe_media. Each call is priced per-task and verified on-chain before execution.

## Output

A plain-text string containing the refactored version of the submitted code, improved for readability, structure, maintainability, or efficiency as guided by the prompt.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "prompt"
 ],
 "properties": {
  "task": {
   "type": "string",
   "description": "Which micro-task to run"
  },
  "input": {
   "type": "string",
   "description": "Alias for prompt"
  },
  "prompt": {
   "type": "string",
   "description": "Text to process"
  }
 }
}
```

## Response schema (JSON Schema)

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

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/hermes-micro-agent-code-refactor-72feaacf/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from hermesmicroservice.theworkpc.com](https://www.zero.xyz/host/hermesmicroservice.theworkpc.com/llms.txt)
