City SDK
Federation and SDK capabilities for many AI products.
Downcity's City SDK is the way AI builders create, deploy, and call City. A Federation can serve multiple web apps, extensions, desktop tools, client demos, and internal tools without making each product rebuild the same AI backend.
City exposes a stable product-facing service boundary instead of a raw provider API. Inside City, capabilities are organized as Service, Action, and AIService.
- the product client holds
city_id + user_token - it calls
text(),stream(),image(), and other services throughUser City - City keeps the model catalog, provider routing, hooks, usage, and env behind the boundary
The server-side runtime class is Federation (also called the Federation here); product clients use the City client to reach it. For the boundary between them, see Federation and City.
Pick your reading path
Deploy a Federation, expose one model, issue a token, and make a product client call text() or stream() successfully.
Separate the Federation, product clients, your business backend, AI gateways, and real providers before implementation details start leaking together.
Real ScenariosI am connecting a real city nowRead the practical guides for pure-client products, multi-product reuse, auth, provider env, hooks, and business logic.
PackagesI want to read by packageJump straight into @downcity/city, client, and CLI docs; official service packages live in Federation Services Docs.
Jump straight to City, User City, Admin City, HTTP API, and environment variables.
One diagram for the full model
User City + city_id + user_tokenProduct clients see stable Service actions and model IDs. Which provider or gateway City uses internally remains a server-side detail.
What the City SDK owns
- runtime database and Service-owned tables
- provider keys and runtime env
user_tokenverification andadmin_secret_keymanagement- model metadata and handlers through
Provider.model()+AIService.use() - public model catalogs through
client.ai.listModels() - usage records and hook extension points
What it does not own
- your user system
- orders, subscriptions, CRM, or content data
- product-specific pages, interaction, and business UX
- a public “unified provider API” for arbitrary third-party systems
More precisely:
The City SDK owns the Federation and its Service-facing AI infrastructure. Your products still own their users, business logic, interface, and pricing model.
Recommended order
- First integration: start at Quickstart
- Want the full city model: read Concepts
- Connecting a real business scenario: read Guides
- Want a package-by-package map: read Packages
- Need concrete interfaces: come back to Reference