- Home
- Skills
- APIs & Backend
- API Client Generator
Works with the AI tools you already use
API Client Generator
Generate dependency-free, type-safe Python and TypeScript API clients from OpenAPI/Swagger specs.
$4.99
API Client Generator
Example session with this skill installed
Generate a Python client for my petstore_api.yaml spec. Use PetStoreClient as the class name and include retries.
- Read your context and instructions
- Compiled the api client generator
Generated a standalone Python client based on your OpenAPI spec. The code uses urllib.request and dataclasses for zero-dependency integration.
Python API Client (petstore_client.py)
import json
import time
import urllib.request
import urllib.error
from dataclasses import dataclass, asdict
from typing import List, Optional, Dict, Any
class APIError(Exception):
def __init__(self, message, status_code=None):
self.message = message
self.status_code = status_code
super().__init__(self.message)
@dataclass
class Pet:
id: int
name: str
tag: Optional[str] = None
class PetStoreClient:
def __init__(self, base_url: str, token: str = None, timeout: int = 30):
self.base_url = base_url.rstrip('/')
self.token = token
self.timeout = timeout
def _request(self, method: str, path: str, params: Dict = None, data: Any = None):
url = f"{self.base_url}{path}"
if params:
query = urllib.parse.urlencode(params)
url += f"?{query}"
req = urllib.request.Request(url, method=method)
if self.token:
req.add_header("Authorization", f"Bearer {self.token}")
if data:
req.add_header("Content-Type", "application/json")
req_data = json.dumps(data).encode("utf-8")
else:
req_data = None
retries = 3
for attempt in range(retries):
try:
with urllib.request.urlopen(req, data=req_data, timeout=self.timeout) as resp:
return json.loads(resp.read().decode("utf-8"))
except urllib.error.HTTPError as e:
if (e.code == 429 or e.code >= 500) and attempt < retries - 1:
time.sleep(2 ** attempt)
continue
raise APIError(e.reason, e.code)
except Exception as e:
raise APIError(str(e))
def list_pets(self, limit: int = 10) -> List[Pet]:
"""List all pets"""
res = self._request("GET", "/pets", params={"limit": limit})
return [Pet(**item) for item in res]
def get_pet(self, pet_id: str) -> Pet:
"""Find pet by ID"""
res = self._request("GET", f"/pets/{pet_id}")
return Pet(**res)
Next steps
- Save the code to
petstore_client.py. - Initialize with
client = PetStoreClient(base_url="https://api.petstore.com", token="YOUR_KEY"). - Call
client.list_pets()to fetch data with full type hinting.
Connects securely to your tools. The creator never sees your data.
About this skill
Hand-writing API request logic is repetitive and error-prone. This skill automates the creation of typed, dependency-free client SDKs directly from OpenAPI 3 or Swagger 2 specifications. It eliminates the overhead of managing third-party request libraries while ensuring full type safety for your API interactions.
What it does
- Python SDK Generation creates a standard library-only client using
urllib,dataclasses, andTypedDict. - TypeScript SDK Generation builds a
fetch-based client with full interface definitions for all schemas. - Resilient Networking implements automatic retries with exponential backoff for 429 and 5xx errors in Python.
- Typed Method Mapping converts
operationIdsinto idiomatic methods with proper path, query, and body parameters. - Built-in Timeouts supports native
AbortControllerin TypeScript and timeout configurations in Python.
How it works
- Provide the Spec by pointing the agent to a local
openapi.yamlorswagger.jsonfile. - Select Language by specifying either
--lang pythonor--lang typescript. - Configure Output by naming the output file and optionally the main client class name.
- Initialize and Call the generated client using the provided constructor for base URLs and auth tokens.
Frameworks & tools
OpenAPI 3, Swagger 2, Python (urllib, dataclasses), TypeScript (Fetch API, AbortController).
Why this beats prompting it yourself
Generic prompts often miss edge cases like exponential backoff or complex nested schema mappings. This skill enforces a consistent, dependency-free architecture that follows best practices for both Python and TypeScript without the bloat of external HTTP libraries.
Use cases
- Generate a type-safe client for a new internal microservice.
- Replace fragile, hand-written
requestsoraxiosboilerplate. - Update frontend API bindings instantly after a backend schema change.
- Create lightweight SDKs for public APIs to distribute to users.
Known limitations
Does not support third-party libraries like requests or axios. Requires valid OpenAPI 3 or Swagger 2 specifications.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean today
- Passed all security checks, Safe to install