Skip to main content

retina-api

Retina's public API for Python, in one package:

  • retina_sdk.RetinaClient, an async client with one method per /v1 operation.
  • 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.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for retina-api 0.1.0
File Size Uploaded Provenance Actions
retina_api-0.1.0.tar.gz 33.2 kB Without provenance Details for retina_api-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for retina-api 0.1.0
File Interpreter ABI Platform Actions
retina_api-0.1.0-py3-none-any.whl Python 3 none any Details for retina_api-0.1.0-py3-none-any.whl

Total release size: 55.1 kB

Release files / retina_api-0.1.0.tar.gz

Download URL retina_api-0.1.0.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5fe695ce465535b08d3d438d34add1e8861c576dfba11bf9f280dd2e7e82f189
BLAKE2b-256 checksum
How to use checksums
210332ecbbd02980e6bed287d560693338e63dece6b3ab2558c662813d98bc09
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.1.0-py3-none-any.whl

Download URL retina_api-0.1.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f43c640dd74e22871af6680b3a1a1c759ee7bb5972be265c0fed871bb9a76b49
BLAKE2b-256 checksum
How to use checksums
6887bf74286399ecce35481b4299d9f60275b3f691dfdb73a31f6a5aa4f5241e
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.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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page