- Home
- Skills
- APIs & Backend
- API Client Generator
Works with the AI Agents you already use
API Client Generator
Generate dependency-free, type-safe Python and TypeScript API clients from OpenAPI/Swagger specs.
$1.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.
Only generates code using Python's standard library or native TypeScript Fetch. Requires valid OpenAPI 3.0 or Swagger 2.0 specs.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 month ago
Requires