# Python Docstring Generator (Google/NumPy/Sphinx)

> Python Docstring Generator (Google/NumPy/Sphinx) is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054001/call, status unknown (last checked 2026-09-13).

Automatically generates Python docstrings for functions and classes in Google, NumPy, or Sphinx style.

## Facts

- Endpoint: GET https://api.strale.io/x402/docstring-generate
- Price: $0.054001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-strale-io-245977f0
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_M-ZM44OPnXyCSTAeyDaGf

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 api-strale-io-245977f0
```

Example prompt: Can you add Google-style docstrings to this Python function: `def calculate_tax(income, rate): return income * rate`?

## When to prefer this

Use this endpoint when you need automated, style-consistent Python docstrings generated for functions or classes and want to choose between Google, NumPy, or Sphinx documentation formats. Ideal for CI/CD pipelines, code review automation, or IDE plugins that need per-function documentation on demand.

## Known failure modes

- Missing required 'code' query parameter returns error
- Invalid or non-Python code may produce malformed or empty docstrings
- Unsupported style value falls back to default or returns error
- Very long code snippets may hit size limits
- Network timeout for complex multi-class inputs

## How this service works

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

## Output

Returns generated Python docstring(s) for the submitted code, formatted in the requested style (Google, NumPy, or Sphinx), covering parameters, return values, and descriptions.

## Example request

```json
{
 "code": "def calculate_tax(income, rate):\n    return income * rate",
 "style": "google"
}
```

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "code"
     ],
     "properties": {
      "code": {
       "type": "string"
      },
      "style": {
       "type": "string",
       "description": "google/numpy/sphinx"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-strale-io-245977f0/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)
