retina-api
Retina's public API for Python, in one package:
retina_sdk.RetinaClient, an async client with one method per/v1operation.retina, a command line tool with one command per method.retina-mcp, an MCP server with one tool per method.
All three are made from the same operation table, so they always offer the same things.
The package depends only on httpx, typer and mcp.
Quickstart: your own Claude Code on Retina
You bring the agent. Retina gives it tools: research, generation, posting, and the numbers back. Your agent runs where you run it; Retina only answers the calls it makes.
1. Install
pip install retina-api
This gives you two commands: retina and retina-mcp.
2. Set the key
Make a workspace key (it starts with rk_) in the Retina console.
Every command and tool reads it from RETINA_API_KEY.
export RETINA_API_KEY=rk_...
retina me
retina me prints your workspace and its credit balance.
RETINA_API_BASE changes the API address, and the default is https://api.retina.dev.
3. Add the server to Claude Code
claude mcp add retina --env RETINA_API_KEY=rk_... -- uvx --from retina-api retina-mcp
Or use the retina-mcp from the venv where you installed the package:
claude mcp add retina --env RETINA_API_KEY=rk_... -- /path/to/venv/bin/retina-mcp
Run claude mcp list to check that retina is connected.
Any other MCP client takes the same command in its JSON config:
{
"mcpServers": {
"retina": {
"command": "uvx",
"args": ["--from", "retina-api", "retina-mcp"],
"env": {"RETINA_API_KEY": "rk_..."}
}
}
}
The server has one tool per /v1 operation, named retina_<method>.
A tool that fails returns the API's error object (success: false, error.code) instead of raising.
It still starts when it cannot reach the API; the tools then answer network_error.
4. A worked example
Ask Claude Code, in plain words:
Read retina_guide. Then use retina_research_outliers to find what beats the usual views for "home espresso" in the last 30 days, with a budget of $0.50. Tell me the three best outliers and what they have in common.
Claude calls retina_guide, then retina_research_outliers, and reads the answer back to you.
The search is charged on success; retina_me shows what it cost.
The same steps from the shell:
retina guide
retina research-outliers --keywords "home espresso" --days 30 --budget-usd 0.5
retina me
From there the loop is retina_generate_media (or retina_upload_file) to make a post, retina_create_post to publish it to a linked account (retina_connect_social links one), and retina_post_stats to read how it did.
The command line
retina catalog
retina generate-media --operation text_to_image --model <model> --prompt "a cat on a skateboard"
retina --help
Each command prints JSON.
--jq <filter> filters the output when jq is installed.
An API error exits 1 and prints the error JSON on stderr.
An API it cannot reach is the same, with the code network_error.
A missing key exits 2.
The client
import asyncio
from retina_sdk import RetinaClient
async def main() -> None:
retina = RetinaClient.from_env()
print(await retina.me())
asyncio.run(main())
For Retina developers
The client is checked against src/retina_sdk/v1_contract.json.
That file is generated from the backend's own /v1 spec by backend/tests/test_the_v1_contract_the_clients_are_checked_against_is_current.py with RECORD_V1_CONTRACT=1.
Do not edit it by hand.
When a /v1 route changes, record the contract again, then add or change the method in src/retina_sdk/client.py.
The tests in tests/ fail until the client matches.
scripts/prove_the_wheel_installs.sh builds the wheel, installs it into a clean venv, and starts retina and retina-mcp with only RETINA_API_KEY set.
It calls no real API.
Metadata
Release files for retina-api 0.2.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 |
|---|---|---|---|---|
| retina_api-0.2.0.tar.gz | 34.9 kB | Without provenance | Details for retina_api-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| retina_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for retina_api-0.2.0-py3-none-any.whl |
Total release size: 58.2 kB
Release files / retina_api-0.2.0.tar.gz
| Download URL | retina_api-0.2.0.tar.gz |
|---|---|
| Size | 34.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b9d56311bbc52fc58282a8c34df44650436beef6395604e21fce0edd9c83506
|
|
BLAKE2b-256 checksum How to use checksums |
bd637b8aaf217a852996a05da88802594c2e8e9088adda8923b90e8ea52b76f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / retina_api-0.2.0-py3-none-any.whl
| Download URL | retina_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
471301ce24849b75822c4a683a46496b843cffd755c1fbede7dd5db563e1d4ab
|
|
BLAKE2b-256 checksum How to use checksums |
b932afc697285ecba6a30a0bcf20c15dcafdd1a7e75cb0f84a75716a9cb96f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for retina-api 0.2.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.