Mecanik API (Python)
Official Python client for the Mecanik API: AI, security analysis, email, reports and developer utility endpoints. Pay-per-use credits, no subscription.
New accounts get 100 free credits. Grab your account UUID and an API token at members.mecanik.dev. Full reference: api.mecanik.dev/docs.
Install
pip install mecanik-api
Quick start
from mecanik_api import MecanikClient
mecanik = MecanikClient(account_id="YOUR_ACCOUNT_UUID", token="YOUR_API_TOKEN")
# Each tool returns just the `result`, and raises MecanikError on failure.
headers = mecanik.tools.security_headers(url="https://example.com")
print(headers["grade"], headers["score"])
tokens = mecanik.tools.token_counter(text="Hello world", models=["gpt-4o", "claude-sonnet-4-6"])
audit = mecanik.tools.website_audit(url="https://example.com")
balance = mecanik.credits() # {"credits": ...}
Error handling
from mecanik_api import MecanikError
try:
mecanik.tools.dns_lookup(domain="example.com")
except MecanikError as err:
print(err.status, str(err), err.errors)
# status 402 -> out of credits; 403 -> bad token; 429 -> rate limited
Lower-level access
# Full envelope {"result", "success", "errors"}
res = mecanik.raw("/tools/dns-lookup", {"domain": "example.com"})
# Any endpoint by path
result = mecanik.call("/tools/hash-generate", {"input": "hello", "algorithm": "sha256"})
Available tools
mecanik.tools.* provides one method per endpoint:
- AI:
ai_code_review,ai_content_summarize,ai_seo_generate,ai_translate,ai_chat,ai_image_generate,ai_extract,ai_alt_text,ai_moderation - Security:
security_headers,tls_check,tech_detect,seo_analyze,dns_lookup,openapi_validate,subdomain_finder,exposed_files - Email:
email_deliverability,email_validator,email_validator_bulk,email_spam_check,email_header_analyzer,email_blacklist_check - Reports:
website_audit,performance_audit,broken_link_checker,carbon_footprint - Utilities:
qr_generate,placeholder_image,hash_generate,jwt_decode,password_strength,cron_explain,token_counter,json_to_code
Account helpers: account(), token_info(), credits(), list_tools().
The machine-readable spec is at api.mecanik.dev/openapi.json.
License
MIT
Release files for mecanik-api 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mecanik_api-1.0.1.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mecanik_api-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / mecanik_api-1.0.1.tar.gz
| Download URL | mecanik_api-1.0.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
715b383dd92f7e7dd9e3d74590e2b1e3ef0508d390a59f24c1128739643ecd37
|
|
BLAKE2b-256 checksum How to use checksums |
4fd62221dc05ba07a3ca1f4ff1ab90a949466b37d4dc9033b2f5df4cccba8e2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / mecanik_api-1.0.1-py3-none-any.whl
| Download URL | mecanik_api-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e85f85d200277c3ba873118c9a0febb220980f027776cb82851880e1d3f33515
|
|
BLAKE2b-256 checksum How to use checksums |
015e54e6aad8ec598afb2d6436954dde966ce3a9006755724e4aa32acf15eacc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|