writehuman
Official WriteHuman API client for Python. Humanize AI-written text, score text for AI
authorship, and read your usage, with typed errors and a retry policy that follows the
API's own Retry-After and never resends a billed request.
pip install writehuman
from writehuman import WriteHuman, InsufficientBalanceError, RateLimitError
wh = WriteHuman("wh_live_your_api_key_here")
out = wh.humanize("Artificial intelligence has transformed numerous industries over the past decade.",
tone="professional")
print(out["results"][0])
print(out["words_remaining"]["total"], "words left")
score = wh.detect("Your text to check here.", include_sentences=True)
print(score["ai_probability"], score["predicted_class"])
print(wh.usage())
Async, same methods:
from writehuman import AsyncWriteHuman
async with AsyncWriteHuman("wh_live_...") as wh:
out = await wh.humanize("...")
Errors
Every failure raises a subclass of WriteHumanError with code (the API's stable error
code), status, retry_after (seconds, when the API sent one) and, on
InsufficientBalanceError, words_remaining.
| exception | API code |
|---|---|
AuthenticationError |
missing_api_key, invalid_api_key |
NoSubscriptionError |
no_subscription |
InsufficientBalanceError |
insufficient_balance |
InvalidRequestError |
invalid_request, forbidden_param, word_limit |
ModerationError |
moderation_blocked |
RateLimitError |
rate_limited, auth_locked_out, queue_full, queue_timeout |
ServiceUnavailableError |
at_capacity, billing_unavailable, detector_unavailable |
ServerTimeoutError |
timeout (the API's 504: nothing charged) |
ProcessingError |
processing_failed, no_results, safety_limit |
BillingError |
billing_failed (some words may have been charged; check usage()) |
APIError |
any code this version does not know (code is preserved) |
ProtocolError, ClientTimeoutError, ConnectionError |
no API body |
try:
wh.humanize(text)
except InsufficientBalanceError as e:
print("out of words:", e.words_remaining)
except RateLimitError as e:
print("slow down; the API asked for", e.retry_after, "seconds")
Retries and timeouts
429,503and504are retried after exactly theRetry-Afterthe API sends, up tomax_retries(default 2). ARetry-Afterabovemax_retry_after(default 60 s, for example an authentication lockout) is not slept through: the error is raised at once withretry_afterset. A missingRetry-Afterwaitsfallback_retry_after(default 2 s).- Nothing else is retried.
humanizeanddetectare billed and non-idempotent, so a client timeout, a dropped connection, or a 429/503/504 that did not come from the API (a load balancer or proxy answering without the API's error body) raises immediately rather than risking a second charge.usageis read-only and may retry those. - Timeouts are total deadlines through the whole response, not per-read limits (
AsyncWriteHumanenforces them exactly;WriteHumanchecks after every chunk of the body, so it can overrun by at most one network read).timeout=sets all operations (float) or per operation ({"humanize": 120, "detect": 30, "usage": 15}, the defaults);connect_timeoutdefaults to 10 s. Every method takes a per-calltimeout=.
wh = WriteHuman(key, timeout={"humanize": 60}, max_retries=3)
Types
HumanizeResponse, DetectResponse, UsageResponse, WordsRemaining and ErrorCode
are generated from the API's OpenAPI document and exported for type checkers. The package
ships py.typed.
This client passes the WriteHuman SDK conformance suite (sdk/conformance in the API
repository), as does the TypeScript client; both implement the same documented policy.
Metadata
Release files for writehuman 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| writehuman-0.1.0.tar.gz | 12.0 kB | Without provenance | Details for writehuman-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| writehuman-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for writehuman-0.1.0-py3-none-any.whl |
Total release size: 24.4 kB
Release files / writehuman-0.1.0.tar.gz
| Download URL | writehuman-0.1.0.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72f58a49d9cad337ab180557fd1f198bcb4d734b3eee1e736e7d9f3e9a0bb7af
|
|
BLAKE2b-256 checksum How to use checksums |
34ec2bab9cf3ea9d8c0c2ed2a981ea9053e76eeab7a1061043c10c2df19be6b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / writehuman-0.1.0-py3-none-any.whl
| Download URL | writehuman-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
634fae2ffbf92fc70882f32c4119c409bb628e66fd061a966a38dff9d834a9c2
|
|
BLAKE2b-256 checksum How to use checksums |
2e9a5ec73a0e382f77053fa8f2d9175ba46a506d2e34cb29fcb55985a1085287
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for writehuman 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.