Python SDK for the SoManyLemons Public API — branded video reels, LinkedIn content, image quotes.
Project description
SoManyLemons Python SDK
Typed Python client for the SoManyLemons Public API. Submit recordings, render branded reels and image quotes, manage brands and drafts — from any Python app, no MCP required.
Install
pip install somanylemons
Quickstart
from somanylemons import SMLClient
client = SMLClient(api_key="sml_your_key_here")
# List recent recordings (compact metadata — no URLs)
for job in client.jobs.list(limit=5):
print(f"{job.id} · {job.title} · {job.clip_count} clips")
# Submit a video and wait for rendered clips
job = client.reels.create_and_wait(
url="https://example.com/recording.mp4",
brand_profile_id=1,
caption_style="LEMON",
timeout=600,
)
for clip in job.clips:
print(clip.url)
# Render an image quote with a pinned template (deterministic output)
result = client.image_quotes.create(
quote_text="Labor productivity is the story of the next five years.",
brand_profile_id=1,
template_id=42,
)
print(result.image_url)
Configuration
| Arg / env var | Default | Notes |
|---|---|---|
api_key / SML_API_KEY |
— (required) | Your sml_xxx key |
base_url / SML_API_URL |
https://api.somanylemons.com |
Override for QAS / local |
timeout |
30.0 |
Seconds per request |
max_retries |
3 |
Retries on 5xx and 429 |
client = SMLClient(api_key="sml_xxx", base_url="https://api.qas.somanylemons.com")
Resources
| Attribute | Endpoints |
|---|---|
client.jobs |
List, get, poll recordings |
client.reels |
Create reels (sync or blocking) |
client.transcribe |
Transcribe URL or file |
client.image_quotes |
Render branded quote images |
client.brands |
Manage brand profiles |
client.drafts |
Content queue |
client.content |
Generate / score / rewrite posts, extract quotes, usage |
Error handling
from somanylemons import QuotaError, RateLimitError, JobFailedError, SMLClient
client = SMLClient(api_key="sml_xxx")
try:
job = client.reels.create_and_wait(url="...")
except QuotaError as exc:
print(f"Over quota: {exc.renders_used}/{exc.render_limit}")
except RateLimitError as exc:
print(f"Rate limited, retry after {exc.retry_after}s")
except JobFailedError as exc:
print(f"Render failed: {exc.message}")
Async
The async client (AsyncSMLClient) lands in 0.2.0. For now, wrap sync calls in asyncio.to_thread.
Security
The SDK is built so that common mistakes cannot leak your API key:
- Keys never appear in
repror logs. The client masks the key in its__repr__and stores it in a_SecretStrwrapper. Explicit access requires.get(). - HTTPS enforced by default. Passing an
http://URL raisesSMLErrorunless you opt in withallow_insecure_http=True(e.g. for local dev againstlocalhost:8000). - Foreign hosts rejected by default. Your
base_urlmust be a SoManyLemons domain. If you need to point at a different host (a staging environment, a proxy), passallow_foreign_host=Trueso the decision is explicit. - Sensible retries only. 5xx and 429 responses retry with exponential backoff; 4xx errors (auth, permissions, validation) fail fast without retry so bad keys don't hammer the server.
If you're integrating the SDK in a shared / multi-tenant app, create one SMLClient per tenant so a per-request key override is never necessary.
Contributing
The project follows PEP 517/621 so any Python toolchain works (pip, uv, poetry, rye, pixi). No lockfile is published — consumers use their own.
# Clone and install in editable mode with dev dependencies
git clone https://github.com/NoMiddleInc/somanylemons-sdk.git
cd somanylemons-sdk
pip install -e ".[dev]"
# Run the test suite (pytest + respx for HTTP mocking)
pytest
# Lint and type-check
ruff check src tests
mypy src
Publish flow (maintainers):
pip install build twine
python -m build
twine upload dist/*
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 somanylemons-0.1.2.tar.gz.
File metadata
- Download URL: somanylemons-0.1.2.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f13e56a4324e73001feb63acadd2dbbfd5a296cf0f69c6f8fcabf287deb9c5e
|
|
| MD5 |
d9ed9f4fa438e428eceb0a5a308d224a
|
|
| BLAKE2b-256 |
41e074f396f3d943edc928b8dde3fdf632a19f84727e790c8f199da389c49235
|
Provenance
The following attestation bundles were made for somanylemons-0.1.2.tar.gz:
Publisher:
publish.yml on NoMiddleInc/somanylemons-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
somanylemons-0.1.2.tar.gz -
Subject digest:
0f13e56a4324e73001feb63acadd2dbbfd5a296cf0f69c6f8fcabf287deb9c5e - Sigstore transparency entry: 1339903309
- Sigstore integration time:
-
Permalink:
NoMiddleInc/somanylemons-sdk@8e9b7ac6f2308d412135cf8d3fec8700bbf2ce59 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/NoMiddleInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e9b7ac6f2308d412135cf8d3fec8700bbf2ce59 -
Trigger Event:
push
-
Statement type:
File details
Details for the file somanylemons-0.1.2-py3-none-any.whl.
File metadata
- Download URL: somanylemons-0.1.2-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
067265848c714a2f93dd3ea8312bea7abc8eab05dea6049d0f0732f07e402a37
|
|
| MD5 |
1659d5396fd8339ebbb7832185ebbe24
|
|
| BLAKE2b-256 |
d713284b02c46b6c99b2a7ecba99977a165e782b5cdb2af278231998f3a69e47
|
Provenance
The following attestation bundles were made for somanylemons-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on NoMiddleInc/somanylemons-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
somanylemons-0.1.2-py3-none-any.whl -
Subject digest:
067265848c714a2f93dd3ea8312bea7abc8eab05dea6049d0f0732f07e402a37 - Sigstore transparency entry: 1339903312
- Sigstore integration time:
-
Permalink:
NoMiddleInc/somanylemons-sdk@8e9b7ac6f2308d412135cf8d3fec8700bbf2ce59 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/NoMiddleInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8e9b7ac6f2308d412135cf8d3fec8700bbf2ce59 -
Trigger Event:
push
-
Statement type: