unitysvc-sellers
Python SDK and CLI for the UnitySVC seller
API (https://seller.unitysvc.com/v1). This package provides:
unitysvc_sellers — a typed Python package (sync Client +
async AsyncClient) that wraps the upstream REST API into
importable, type-checked method calls.
usvc_seller — a CLI built on top of the SDK for day-to-day
seller operations (catalog management, secret rotation, service
lifecycle) without writing code.
What this package manages
The package is organized around the kinds of data a seller works with. Each
has a CLI command group and an SDK namespace.
| Domain |
Where |
What it is |
Key actions |
| specs |
local |
Service data as files — explicit provider + offering + listing folders, or param files that reference local/system templates |
validate · format · test · upload |
| services |
remote |
Your live and in-review services |
list · show · submit · withdraw · deprecate · set-visibility · update |
| groups |
local + remote |
Service groups you author and upload to bundle related services |
author + upload · list · show · delete |
| promotions |
local + remote |
Price rules you author and upload to discount your services for customers |
author + upload · list · show · activate · pause · delete |
| secrets |
remote |
Named secret values (upstream API keys), referenced by name |
list · show · set · delete |
| templates |
remote |
The platform's catalog of service templates you can instantiate |
list · show |
There is one file-based route to creating services: put service definitions
under specs/ and run specs upload. A definition can be a full spec folder,
a param file rendered by a local template, or a param file that names a system
template and is rendered by the backend. If that system template is attached to a
PlatformService, the backend adds the resulting private service as a platform
member after review activation. specs upload also carries any groups and
promotions you author alongside them (service_group.* / promotion.*
files, upserted by name).
Platform-member lifecycle overrides
A platform member is a system-template parameter file beneath
member-services/<platform>/<provider>/<member>.json. To deliberately
retire one without changing a generated base file, add its sibling override:
// member-services/llm-fast/acme/model.override.json
{
"parameters": {"status": "deprecated"}
}
Parameter-file overrides are deep-merged before validation, expansion, and
upload, so this uses exactly the same parameters.status rendering path as an
automatically retired member. Remove the override to restore the template
default (ready) when the generated base file has no retirement marker.
deprecate-missing writes the same status to
the generated base parameter file for members absent from its upstream source;
when that member reappears, it removes only that base marker, leaving an
intentional override authoritative.
→ Full docs: Services
(the spec model + the two routes + status lifecycle) ·
Service Templates
(system templates, platform services, your own populators) ·
File Schemas
(every field and option).
Install
pip install unitysvc-sellers
This pulls in unitysvc-core
for the shared data models, JSON schemas, and generic file validator;
plus httpx, attrs, typer, and rich.
This release requires unitysvc-core>=0.3.0, which types
upstream_access_config channels and moves enrollment parameters from the
listing to the channel that reads them. Specs written for older releases need
migrating; see
Migrating to unitysvc-core 0.3.0.
Programmatic usage
from unitysvc_sellers import Client
client = Client(api_key="svcpass_...") # or Client.from_env()
# List services — iterate the page directly (the result is a ServiceList).
for svc in client.services.list(limit=50, status="active"):
print(svc.id, svc.name, svc.status)
# Fetch one — `svc` is a Service active-record bound to its id.
svc = client.services.get(service_id)
print(svc.name, svc.status)
# Mutate via the bound handle (no need to re-pass the id).
svc.update({"status": "pending"})
svc.submit() # shortcut for {"status": "pending"}
# Promotions — upsert returns a Promotion bound to its id.
promo = client.promotions.upsert({
"name": "summer-2026",
"scope": {"customers": "*"},
"pricing": {"type": "multiply", "factor": "0.80"},
"status": "active",
})
promo.update({"status": "paused"})
# Service groups — same pattern.
grp = client.groups.upsert({"name": "premium", "service_ids": [...]})
grp.update({"display_name": "Premium tier"})
# Push an entire catalog directory.
result = client.upload("./my-catalog", dryrun=False)
print(f"services: {result.services.success}/{result.services.total}")
Configuration
| Source |
Default |
Override |
| API key |
(required) |
Client(api_key=...) / UNITYSVC_SELLER_API_KEY |
| Base URL |
https://seller.unitysvc.com/v1 |
Client(base_url=...) / UNITYSVC_SELLER_API_URL |
| Timeout |
30 s |
Client(timeout=...) |
The seller context is encoded entirely in the API key (svcpass_...),
so no separate seller_id argument is required.
Env var naming: env vars are namespaced to the seller role
(UNITYSVC_SELLER_API_KEY, UNITYSVC_SELLER_API_URL) so a single
host can run both the seller SDK and the future customer SDK side by
side without collision — each picks up its own credentials.
URL layout: the SDK's generated paths are semantic resource paths
(/services/{id}, /documents/{id}, /promotions, /service-groups)
with no /seller wrapper. The seller scope is carried by the
subdomain + API key. The same generated SDK works against any
deployment layout without regeneration:
# Default: production seller subdomain
Client() # reads UNITYSVC_SELLER_API_URL or defaults to
# https://seller.unitysvc.com/v1
# Staging
Client(base_url="https://seller.staging.unitysvc.com/v1")
# Local development against a running backend
Client(base_url="http://localhost:8000/v1/seller")
Secrets
Manage encrypted seller secrets (API keys, tokens, credentials).
Values are write-only — only metadata is ever returned. The API
mirrors GitHub's secrets API: set(name, value) is idempotent and
covers both create and rotate.
# List all secrets (metadata only)
secrets = client.secrets.list()
for s in secrets.data:
print(s.name, s.created_at)
# Get one secret's metadata by name
meta = client.secrets.get("OPENAI_API_KEY")
# Create or rotate (idempotent)
client.secrets.set("OPENAI_API_KEY", "sk-...")
# Delete a secret (immediate effect on running services)
client.secrets.delete("OPENAI_API_KEY")
Methods:
| Method |
Parameters |
Returns |
Description |
secrets.list(skip=0, limit=100) |
skip, limit |
SecretsPublic |
List secrets (metadata only) |
secrets.get(name) |
name: str |
SecretPublic |
Get one secret's metadata |
secrets.set(name, value) |
name: str, value: str |
SecretPublic |
Idempotent create-or-replace |
secrets.delete(name) |
name: str |
None |
Permanently delete a secret |
Secret names must be uppercase with underscores (e.g. OPENAI_API_KEY,
STRIPE_SECRET). Names starting with __ are reserved for platform use.
Pagination
services.list, promotions.list, and groups.list use
cursor-based pagination. Each call returns an iterable list
wrapper (ServiceList, PromotionList, GroupList) that exposes
data, next_cursor, has_more, and next_page():
# Single page — iterate the wrapper directly
page = client.services.list(limit=50)
for svc in page:
print(svc.name)
# Manual pagination via next_page()
while page.has_more:
page = page.next_page()
for svc in page:
...
# Or let the SDK walk every page for you
for svc in client.services.iter_all(status="active"):
print(svc.name)
The CLI list commands accept --cursor and --all (to auto-follow
cursors and render the combined result).
Async client
The same API surface is exposed as AsyncClient for use in asyncio
contexts (FastAPI, Starlette, Trio-via-anyio, scripts using
asyncio.run). Sync iteration walks the current page; for full
iteration use iter_all():
import asyncio
from unitysvc_sellers import AsyncClient
async def main():
async with AsyncClient(api_key="svcpass_...") as client:
# One page at a time.
services = await client.services.list(limit=50)
for svc in services:
print(svc.id, svc.name)
# Or every page, automatically:
async for svc in client.services.iter_all(status="active"):
print(svc.id, svc.name)
# Active-record mutations work the same way.
promo = await client.promotions.get(promo_id)
await promo.update({"status": "active"})
asyncio.run(main())
Each async method has the exact same signature as its sync counterpart
on Client. The remote usvc seller services|promotions|groups
commands all use AsyncClient under the hood.
Errors
All errors are subclasses of unitysvc_sellers.SellerSDKError:
from unitysvc_sellers import (
SellerSDKError,
AuthenticationError, # 401
PermissionError, # 403
NotFoundError, # 404
ValidationError, # 400, 422
ConflictError, # 409
RateLimitError, # 429
ServerError, # 5xx
APIError, # base for everything above
)
Each carries status_code, detail (parsed body if JSON), and
response_body for debugging.
CLI: usvc_seller
The CLI has two sets of commands:
usvc seller specs ... — local operations on a specs/ repo (no network)
usvc seller services|templates|promotions|groups|secrets ... —
remote operations against the seller backend, all using the SDK's
AsyncClient under the hood
Local commands (specs)
usvc seller specs validate [SPECS_DIR] # schema + catalog-layout validation
usvc seller specs format [SPECS_DIR] # normalize JSON/TOML/MD files
usvc seller specs populate [SPECS_DIR] # run the repo's populator (templates/config.json)
usvc seller specs show SERVICE_NAME # expanded data for one service
usvc seller specs list services|providers|offerings|listings|sellers [SPECS_DIR]
usvc seller specs list-tests [NAME] # list local code-example / connectivity tests
usvc seller specs run-tests [NAME] # run them locally
usvc seller specs show-test SERVICE # show last local test result
usvc seller specs upload [NAME] # upload services + promotions + groups
[--api-key svcpass_...] # defaults to $UNITYSVC_SELLER_API_KEY
[--base-url https://...] # defaults to $UNITYSVC_SELLER_API_URL or staging
[--type services|promotions|groups] # restrict to one resource kind
NAME is a service_name (= listing.name) — a literal or an fnmatch pattern
('cohere/*'); omit it to act on the whole repo.
Remote commands (require $UNITYSVC_SELLER_API_KEY or --api-key)