# Strale Docstring Generator

> Strale Docstring Generator is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054/call, status unknown (last checked 2026-09-15).

Generates a docstring for a given code snippet in a specified style (Google, NumPy, or Sphinx)

## Facts

- Endpoint: GET https://api.strale.io/x402/v2/docstring-generate
- Price: $0.054/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/strale-docstring-generator-ee22b116
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1klltxP_dFnigNaGIljOH

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 strale-docstring-generator-ee22b116
```

Example prompt: Generate a Google-style docstring for this Python function: `def add(a, b): return a + b`

## When to prefer this

Choose this endpoint when you need to programmatically generate structured, style-compliant docstrings (Google, NumPy, Sphinx) for Python code and want an auditable output with cryptographic chain hashing. Prefer it over generic LLM prompting when you need consistent formatting, style enforcement across a codebase, or an audit trail for documentation generation in regulated or enterprise environments.

## Known failure modes

- Missing or empty 'code' query parameter returns a validation error
- Invalid style value (not google/numpy/sphinx) may return an error or default behavior
- Malformed or unparseable code snippets may produce low-quality or empty docstrings
- Rate limiting or payment failures via x402 protocol block the request
- Non-HTTP method type in input schema causes request rejection

## How this service works

Add Python docstrings to functions and classes. Supports Google, NumPy, and Sphinx styles.

## Output

Returns a generated docstring for the provided code snippet, formatted in the requested style (Google, NumPy, or Sphinx). The response includes the docstring text ready to insert into the source code, along with a cryptographic audit record for traceability.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "code"
 ],
 "properties": {
  "code": {
   "type": "string"
  },
  "style": {
   "type": "string",
   "description": "google/numpy/sphinx"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "style": {
  "type": "string"
 },
 "documented_code": {
  "type": "string"
 },
 "functions_documented": {
  "type": "integer"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/strale-docstring-generator-ee22b116/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
