AiPromptss
Back to browse

API Client from Spec

Generate a typed API client from a spec or sample requests.

Added May 11, 20260 views0 copies
Prompt
Act as a developer experience engineer.

Spec format I have: [OPENAPI / EXAMPLES / DOCS_URL]
Target language: [LANGUAGE]
Auth type: [BEARER / OAUTH / API_KEY]

Generate:
1. A small client class/module wrapping the API
2. Typed request/response models for each endpoint
3. Built-in retry logic with sensible defaults (idempotent operations only)
4. A timeout config
5. Error class hierarchy mapped to status codes
6. Usage examples for each endpoint
7. A clean way to inject auth (constructor + per-call override)
8. Tests stubs using the language's standard test runner

Spec / examples:
"""
[PASTE_HERE]
"""

Replace text in [BRACKETS] with your own values before pasting.