Production-grade Python SDK for Zora AI SMS fraud detection APIs
Project description
Zora AI SMS SDK
A production-grade Python SDK for the Zora AI fraud detection platform's SMS analysis APIs.
Installation
From the package folder:
pip install .
Or from repository root:
pip install ./packages/sms_package
Quickstart
import asyncio
from zora_ai import ZoraAIClient, SmsAnalyzer
async def main() -> None:
client = ZoraAIClient(
api_key="zora_xxx",
base_url="http://localhost:8000",
timeout=30,
max_retries=3,
)
sms = SmsAnalyzer(client)
try:
result = await sms.analyze(
text="Your account is blocked. Verify now: http://fake-link.example",
with_llm_explanation=True,
)
print(result.request_id)
print(result.risk_score)
print(result.fraud_type)
print(result.sub_scores)
finally:
await client.aclose()
asyncio.run(main())
What You Get
- API-key Bearer authentication
- Retry with exponential backoff
- Typed result models
- Structured exceptions by error type
- Optional request/response logging
- Request ID propagation when available
API Surface
ZoraAIClient (async)
await get(path, params=None, timeout=None)await post(path, json=None, timeout=None)- Handles status codes:
400->APIError401->AuthenticationError429->RateLimitError5xx->APIError
SmsAnalyzer
await analyze(text, with_llm_explanation=False)->SMSAnalysisResult
Models
SMSAnalysisResult includes:
request_idrisk_scoreconfidencefraud_typeexplanationsub_scores(nlp_score,similarity_score,stylometry_score)- raw response access for advanced use
Error Handling Example
import asyncio
from zora_ai import ZoraAIClient, SmsAnalyzer
from zora_ai.exceptions import AuthenticationError, RateLimitError, APIError
async def main() -> None:
client = ZoraAIClient(api_key="zora_xxx")
sms = SmsAnalyzer(client)
try:
result = await sms.analyze("hello")
print(result)
except AuthenticationError:
print("Invalid API key")
except RateLimitError as exc:
print(f"Rate limited. Retry after: {exc.retry_after}")
except APIError as exc:
print(f"API failed: {exc.status_code} {exc}")
finally:
await client.aclose()
asyncio.run(main())
Local Testing Checklist
- Ensure backend is running at
http://localhost:8000. - Generate an API key from your profile page (
/home/profile) or viaPOST /api-keys/request. - Install SDK:
pip install ./packages/sms_package. - Run a quick script:
import asyncio
from zora_ai import ZoraAIClient, SmsAnalyzer
async def main() -> None:
client = ZoraAIClient(api_key="<YOUR_KEY>")
sms = SmsAnalyzer(client)
try:
print(await sms.analyze("Urgent: update bank KYC now", with_llm_explanation=True))
finally:
await client.aclose()
asyncio.run(main())
Notes
- This SDK is currently focused on SMS analysis.
base_urlis configurable for local/staging/prod environments.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zora_ai_sms_sdk-0.1.0.tar.gz
(7.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zora_ai_sms_sdk-0.1.0.tar.gz.
File metadata
- Download URL: zora_ai_sms_sdk-0.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0aad47f1e784aa3fdcebf7ed77a7f9f282144e6d753665780605b8ca5ad0731d
|
|
| MD5 |
d6304c00bb169c26a942cb4b9b6e9c90
|
|
| BLAKE2b-256 |
462a4eab31afb3ad2d65c01c939f2a754877739e2d1ed39af1cba16a557dda7b
|
File details
Details for the file zora_ai_sms_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zora_ai_sms_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35433f8a9a517d54d813ddafbb93d4723275c927f5e259af574a3a56b862b483
|
|
| MD5 |
fc6adb757fcfffae3ee00459194006d0
|
|
| BLAKE2b-256 |
6b99c7fccf7f25968c0cb186a715260ed39a52d32368ab88d1e034ef90b5d058
|