# fastapi.online — Docstring Generator

> fastapi.online — Docstring Generator is a paid API for AI agents from api.fastapi.online, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Generates docstrings for a given code snippet in a specified documentation style

## Facts

- Endpoint: POST https://api.fastapi.online/docstring-generate
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/fastapi-online-docstring-generator-6b9db94b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_JFFWiUKY6v_pgXNcVcYcv

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 fastapi-online-docstring-generator-6b9db94b -d '<json body>'
```

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

## When to prefer this

Choose this endpoint when you need a quick, pay-per-call docstring generation without signing up for a service. It is ideal for AI agents automating code documentation tasks, CI/CD pipelines that enforce documentation standards, or developers who want on-demand docstrings in a specific style (Google, NumPy, reST) without a subscription.

## Known failure modes

- Empty or invalid code input returns a 422 validation error
- Unsupported or misspelled style value may produce generic output or an error
- Very long code snippets near the 20,000 character limit may result in truncated or low-quality docstrings
- Payment not included or insufficient funds results in a 402 Payment Required response
- Model inference errors may return a 500 internal server error

## How this service works

Chat, embeddings, OCR, speech-to-text, image editing, image understanding (captioning/Q&amp;A), text-to-speech, translation, writing tools, classification tools, developer tools, local utilities, format/checksum validators, encoding &amp; crypto utilities, date/time calculators, geo/coordinate math, math &amp; finance calculators, novelty tools, and business/social writing generators — 179 endpoints in all, across multiple specialized self-hosted models. Pay per call with crypto — no signup — or get an API key.

## Output

Returns a generated docstring string suitable for insertion into the provided code, covering parameters, return types, and a description of the function's behavior, formatted according to the requested documentation style (e.g. Google, NumPy, reStructuredText).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "code": {
   "type": "string",
   "maxLength": 20000,
   "minLength": 1
  },
  "style": {
   "type": "string",
   "maxLength": 40
  }
 }
}
```

## More

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