Understand Downcity City
AI Architecture
The CityModel, AIService, AIChannel, and LanguageModelV3 execution path.
City client / Agent
|
v
CityModel (LanguageModelV3)
|
v
Federation AIService
auth -> model lookup -> fallback -> reasoning -> metering
|
v
AIChannel.stream(ctx, LanguageModelV3CallOptions)
|
v
AI SDK model or private upstream adapterCityModel is the client-side executable model. It knows the public CityModelDescriptor and the Federation transport, but never knows upstream keys or vendor protocol details.
AIService is the server-side orchestrator. It owns route selection, fallback, reasoning validation, usage normalization, and billing.
AIChannel is the server-side upstream boundary. It owns connection configuration, upstream model selection, AI SDK providerOptions, and conversion into LanguageModelV3StreamResult.
The OpenAI-compatible endpoint is an adapter, not another execution path:
OpenAI JSON/SSE -> V3 call -> AIService -> AIChannel.stream -> V3 stream -> OpenAI JSON/SSE