Technical Architecture and Practice of a City-Level AI Open Platform
This article explains the technical architecture and engineering practices behind a city-level AI open platform that unifies local compute resources, model capabilities, and security governance into reusable public infrastructure. It covers the five-layer architecture, model abstraction and version registration, inference adaptation, compute scheduling and elasticity, unified open APIs and developer experience, multi-tenancy, quotas and security governance, observability and cost operations, plus a phased rollout plan and common risks. Readers will learn how to build secure, controllable, and continuously evolving AI applications under local compute constraints.
1. Background and Problem Definition
In recent years, government and city-level AI demand has shifted rapidly from “isolated pilots” to “supply at scale.” A common early approach was to have each business system connect directly to external inference services, which exposed four structural problems: data-egress risk that is hard to assess, duplicated compute procurement with low utilization, fragmented model capability interfaces that force redundant application development, and the absence of unified auditing and quota mechanisms.
The core goal of a city-level AI open platform is to converge “model capabilities + compute resources + security governance” into reusable public infrastructure. Its typical form is a platform that brings domestic large models and a local government compute pool under unified management, exposing standardized capability interfaces upward while shielding heterogeneous compute and multi-version model differences downward.
It is worth emphasizing that the value of such a platform does not lie in “having integrated a particular model,” but in turning one-off model integration into a sustainable capability supply system that can be operated over time.
2. Overall Layered Architecture
A deployable platform is usually divided into five layers, decoupled from each other through explicit contracts:
- Compute resource layer: local training/inference clusters, typically including general compute nodes and accelerator card nodes, orchestrated uniformly through a container platform, with high-performance parallel file storage and object storage carrying training corpora and model artifacts respectively.
- Model serving layer: responsible for model weight management, version registration, inference engine adaptation, and support for batch processing and streaming output.
- Capability open layer: exposes general capabilities such as text generation, embedding, reranking, and multimodal understanding through a unified gateway, shielding differences among backend models.
- Governance and operations layer: identity authentication, tenants and quotas, metering and billing, audit logs, and content safety.
- Application ecosystem layer: scenario applications for government departments and enterprises, such as intelligent Q&A, assisted document generation, code assistance, and data analysis.
The key constraint of this layering is that upper layers must not be aware of lower-layer compute models or model version details, which ensures application portability.
3. Integrating Domestic Large Models with Local Compute
3.1 Model Abstraction and Version Registration
The platform should maintain a metadata description for each model, including context length, supported functional modes (chat/embedding/multimodal), rate-limiting policy, and version status (canary/stable/deprecated). The application side references only a “capability identifier + version policy” rather than hard-coding a specific model.
# Model registration metadata examplemodel_id: nlp-chat-stdcapability: chat.completioncontext_window: 32768features: [stream, tool_calling, json_mode]version_policy: stable # stable | canary | deprecatedserving:replicas: 4max_batch_tokens: 16384quota_ref: tenant_default
3.2 Inference Adaptation Layer
Different inference engines differ in parameter naming, streaming protocols, and batching behavior, so an adaptation layer is needed to translate unified internal requests into executable backend calls and normalize the results. The adaptation layer also handles timeout control, retries, and fallback: when the primary model is unavailable, it can switch to a capability-equivalent backup version and mark the response with a fallback indicator, making it easier for the application side to implement business-level fallbacks.
3.3 Compute Scheduling and Elasticity
The practical constraint of local compute is limited total capacity with pronounced peaks and troughs. Viable strategies include: prioritizing inference workloads while allowing training jobs to be preempted; partitioning resource pools by priority; setting queuing and maximum wait time for long-tail requests; and running batch offline tasks during nighttime troughs (such as corpus embedding and evaluation regression). Resource utilization and response latency should be continuously observed through a monitoring and alerting system rather than tuned once.
4. Unified Open APIs and Developer Experience
API design should follow the “principle of least surprise”: clear path semantics, layered error codes (parameter error/quota exceeded/content blocked/backend unavailable), and consistency between streaming and non-streaming. Example:
POST /v1/chat/completionsAuthorization: Bearer <token>Content-Type: application/json{"model": "nlp-chat-std","messages": [{"role": "user", "content": "Summarize the key points of this document"}],"stream": true,"max_tokens": 1024}
Supporting capabilities are equally important: interactive API debugging, request samples and error code documentation, SDKs and code snippets, and change announcements with version deprecation cycles. A lack of developer experience often causes a platform to be bypassed faster than technical defects do.
5. Multi-Tenancy, Quotas, and Security Governance
- Identity and permissions: unified identity integration, three-level authorization by “tenant—application—caller,” issuing credentials with least privilege and supporting rotation.
- Quotas and rate limiting: use token buckets to control requests per second and concurrency, and daily/monthly quotas to control total volume; return an explicit error code when a quota is exceeded rather than silently queuing.
- Content safety: bidirectional filtering of input and output, sensitive data identification and masking, and a manual review step for high-risk scenarios.
- Auditing and traceability: record the caller, model version, latency, token usage, and content safety decision; store logs centrally and set a retention period.
- Data boundary: define the technical implementation path for “data does not leave the domain,” with both training and inference closed-loop within the local environment.
6. Observability and Cost Operations
It is recommended to collect four categories of core metrics: service quality (success rate, time to first token, end-to-end latency percentiles), resources (accelerator utilization, GPU memory usage, queue length), cost (resource consumption per thousand tokens, allocation by tenant), and security (block rate, review hit rate). On this basis, establish a weekly capacity review mechanism that uses data to decide scaling, rate-limiting thresholds, and model version switching.
7. Rollout Roadmap and Common Risks
A three-phase approach is recommended: the first phase completes compute onboarding and opens a single capability, getting authentication and metering working end to end; the second phase expands the capability matrix and introduces canary release and fallback; the third phase opens the ecosystem and accumulates scenario templates and best practices.
Common risks include: turning the platform into an “API forwarding layer” without governance capabilities; upgrading model versions without regression evaluation; overly coarse quota policies that throttle critical business; and neglecting documentation and developer support, which creates adoption resistance. The way to avoid these is to treat governance, evaluation, and documentation as engineering deliverables equally important as inference performance.
In summary, the competitive barrier of a city-level AI open platform is not model parameter scale, but the engineering maturity of the trinity of “unified access + fine-grained governance + stable operations.” For developers, mastering this layered design and governance checklist is enough to build secure, controllable, and continuously evolving AI applications under local compute conditions.
