LingXiModelSDK
Cross-language, cross-provider AI infrastructure and official SDK for the LingXi public model catalog (https://models.lingxifox.cn/models.json).
MIT License · Monorepo · In-process by default.
Architecture (2.0)
LingXiModelSDK provides three independent, parallel entry points:
- Model Catalog (10 languages: Swift, Rust, Go, TS/JS, Python, Java, C++, C#, Kotlin, Dart) Read-only model and provider metadata: identity, context/output limits, capabilities, pricing, and freshness. Requires no API keys or inference runtime.
- Native Provider (nine protocols with core mock evidence)
Direct upstream communication using each provider's native protocol, request/response types, AWS SigV4 signing, and SSE, NDJSON and Amazon Event Stream without forcing a unified abstraction.
- Declarative Registry (327 providers): registry/registry.json, specs/provider-registry-v1.md
- Protocols: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, Google Gemini, AWS Bedrock, Google Vertex AI, Azure OpenAI, Ollama, Cohere (docs/feature-matrix.md)
- Unified Provider (opt-in LMP and language-specific alpha coverage)
Normalized LingXi Model Protocol (LMP) across providers. See the feature matrix for tested paths and incomplete mappings.
- Optional HTTP Gateway: gateway/, specs/gateway-v1.md
- Benchmarks & Security Audit: docs/performance-security-audit.md
- Support Evidence Matrix: docs/support-matrix.md
- Local verification:
scripts/test-all.sh, Phase 7 audit and the Phase 8 roadmap section - Real-world replay acceptance: docs/replay-qualification.md
- Platform and browser acceptance: docs/platform-acceptance.md
- Known limitations: docs/known-limitations.md
- Swift 0.1.x to 2.0 migration: docs/migration-swift-1-to-2.md
- Changelog: CHANGELOG.md
See ROADMAP.md and specs/architecture-v2.md for full details.
Quick start (2.0.0-alpha.1)
The three entry points are independent; use only the one you need.
Model Catalog - no key, no runtime, no Rust core:
import LingXiModelSDK
let catalog = try await LingXiModelCatalog.load()
print(catalog.model(provider: "deepseek", id: "deepseek-v4-flash")?.name ?? "")
Native Provider - the provider's own wire protocol, payloads and stream frames:
import { NativeClient } from "@lingxifox/model-sdk/native";
const raw = await new NativeClient().anthropicMessages(
{ baseURL: "https://api.anthropic.com", apiKey: process.env.ANTHROPIC_API_KEY! },
{ model: "claude-sonnet-4-5", messages: [{ role: "user", content: "hi" }] },
);
Unified Provider - one normalized protocol across providers, with explicit errors for anything a provider cannot express:
from lingxi_model_sdk.unified import UnifiedClient
response = UnifiedClient().complete(
"anthropic_messages",
"https://api.anthropic.com",
api_key,
{"model": "claude-sonnet-4-5",
"messages": [{"role": "user", "content": [{"type": "text", "text": "hi"}]}]},
)
print(response["content"])
The Native and Unified paths need the Rust core, and the published packages do not bundle it:
cargo build --release --manifest-path core/Cargo.toml
export LINGXI_CORE_LIB="$PWD/core/target/release/liblingxi_core.dylib" # .so on Linux, .dll on Windows
Verify an install the way the release does - build the artifact, install it into an empty project and run the public-API checks against the offline replay upstream:
./scripts/verify-distribution.sh # all ten languages
./scripts/verify-distribution.sh --only go # one language
Public Catalog Website (website/)
The models.lingxifox.cn service is implemented as a single-binary Go 1.23+ server (CGO_ENABLED=0, standard library only, embedded templates/CSS/JS/icons).
cd website
go test -race ./...
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o lingxi-models .
./lingxi-models -listen 127.0.0.1:8080 -data-dir ./data
See website/README.md for CLI flags, sync behavior, and compatibility notes.
Swift Model Catalog SDK (Shipped · 0.1.x)
Foundation-only Swift Package Manager library (macOS 13+, iOS 16+, tvOS 16+, watchOS 9+).
Installation
// Package.swift
dependencies: [
.package(
url: "https://github.com/LingXiFox/LingXiModelSDK.git",
from: "0.1.0"
)
]
.target(
name: "MyApp",
dependencies: [
.product(
name: "LingXiModelSDK",
package: "LingXiModelSDK"
)
]
)
Usage
import LingXiModelSDK
let catalog = try await LingXiModelCatalog.load()
if let model = catalog.model(provider: "deepseek", id: "deepseek-v4-flash") {
print(model.name) // display name
print(model.contextWindow ?? 0) // tokens
print(model.maxOutputTokens ?? 0) // tokens
print(model.capabilities.reasoning) // reasoning model?
print(model.capabilities.toolCalling) // tool calling?
print(model.pricing.input ?? 0.0) // USD per 1M input tokens
print(model.pricing.output ?? 0.0) // USD per 1M output tokens
}
let eligible = catalog.models(matching: ModelFilter(
vision: true,
minimumContextWindow: 200_000
))
print(catalog.revision.schemaVersion)
print(catalog.revision.catalogRevision)
print(catalog.revision.generatedAt as Any)
Offline Use & Tests
let catalog = try LingXiModelCatalog.decoded(from: Data(contentsOf: url))
swift build
swift test
License
MIT — see LICENSE.







