Skip to content

feat: add Spark MaaS AI model provider support #1893

Open
dongjiang1989 wants to merge 1 commit into
kagent-dev:mainfrom
dongjiang1989:add-spark-model
Open

feat: add Spark MaaS AI model provider support #1893
dongjiang1989 wants to merge 1 commit into
kagent-dev:mainfrom
dongjiang1989:add-spark-model

Conversation

@dongjiang1989
Copy link
Copy Markdown
Contributor

Summary

Introduce Spark MaaS AI as a new model provider that routes through the Spark MaaS platform's OpenAI-compatible interface, providing unified access to multiple model families (Spark, DeepSeek, GLM, miniMax, Qwen, etc.) via a single endpoint.

  • Add Spark MaaS AI (spark_maas_ai) as a new supported model provider across the full stack (Go ADK, API, Python ADK, UI)
  • Spark MaaS AI reuses the OpenAI-compatible interface internally (NewOpenAIModelWithLogger) with a configurable base_url
  • Full CRUD support: model definition, translation, HTTP API handlers, and UI components including a custom icon

Changes

Go ADK & API

  • go/api/adk/types.go: Add SparkMaaSAI struct with MarshalJSON/GetType/ParseModel support
  • go/api/adk/types_test.go: Add unit tests for SparkMaaSAI JSON marshal/unmarshal and GetType
  • go/adk/pkg/agent/agent.go: Add CreateLLM case for *adk.SparkMaaSAI → NewOpenAIModelWithLogger
  • go/api/v1alpha2/modelconfig_types.go: Add Spark MaaS AI to v1alpha2 model config
  • go/core/internal/httpserver/handlers/: Add handler support for Spark MaaS AI model provider config
  • CRDs & Helm templates: Update kagent.dev_modelconfigs.yaml and kagent.dev_modelproviderconfigs.yaml

Python ADK

  • python/packages/kagent-adk/src/kagent/adk/types.py: Add SparkMaaSAI model type

UI

  • ui/src/components/icons/SparkMaaSAI.tsx: New Spark MaaS AI icon component
  • ui/src/components/models/ModelsListSection.tsx: Register Spark MaaS AI in models list
  • ui/src/lib/providers.ts & ui/src/types/index.ts: Add provider type definitions
  • ui/src/app/models/new/page.tsx: Enable Spark MaaS AI in new model creation flow

Test

  • Verify go test ./go/api/adk/... passes (new SparkMaaSAI JSON tests)
  • Create a Spark MaaS AI model via UI and verify it saves correctly
  • Deploy an agent using Spark MaaS AI and verify LLM calls succeed
  • Verify CRD generation includes spark_maas_ai in model type enum

Copilot AI review requested due to automatic review settings May 19, 2026 13:21
@github-actions github-actions Bot added the enhancement New feature or request label May 19, 2026
@dongjiang1989
Copy link
Copy Markdown
Contributor Author

cc @EItanya PTAL

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Spark MaaS AI as a first-class model provider, wiring it through the platform’s OpenAI-compatible interface so Spark MaaS-hosted model families can be configured and used like existing providers across the Go API/ADK, Python ADK, CRDs/Helm, and UI.

Changes:

  • Introduces a new provider enum/type (SparkMaaSAI / spark_maas_ai) and associated config (baseUrl / base_url) across API schemas, Go/Python ADKs, and UI types.
  • Adds backend support for listing Spark MaaS models/providers, translating Spark MaaS configs into ADK configs, and instantiating an OpenAI-compatible LLM client.
  • Updates CRDs/Helm and UI flows (provider selection, model creation/editing, provider icon) to support Spark MaaS.

Reviewed changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ui/src/types/index.ts Adds Spark MaaS provider config payload typing.
ui/src/lib/providers.ts Registers Spark MaaS provider metadata (links/help) for UI.
ui/src/components/ProviderCombobox.tsx Adds Spark MaaS icon mapping for provider picker.
ui/src/components/models/ModelsListSection.tsx Ensures Spark MaaS provider params are shown/handled in model list.
ui/src/components/ModelProviderCombobox.tsx Adds Spark MaaS icon mapping for model/provider combobox.
ui/src/components/icons/SparkMaaSAI.tsx Introduces Spark MaaS provider SVG icon component.
ui/src/app/models/new/page.tsx Enables Spark MaaS in the model creation/edit payload flow.
python/packages/kagent-adk/src/kagent/adk/types.py Adds SparkMaaSAI model type and routes it through the OpenAI-compatible client.
helm/kagent-crds/templates/kagent.dev_modelproviderconfigs.yaml Extends provider enum in Helm-rendered CRD template.
helm/kagent-crds/templates/kagent.dev_modelconfigs.yaml Extends model config schema with Spark MaaS provider + config + validations.
go/core/internal/httpserver/handlers/models.go Adds supported-model listings for Spark MaaS provider.
go/core/internal/httpserver/handlers/modelproviderconfig.go Adds Spark MaaS provider config type to supported providers listing.
go/core/internal/controller/translator/agent/adk_api_translator.go Translates Spark MaaS ModelConfig into ADK model config + env vars.
go/core/internal/controller/translator/agent/adk_api_translator_test.go Adds translator tests for Spark MaaS (secret-based + passthrough).
go/api/v1alpha2/zz_generated.deepcopy.go Adds deepcopy support for SparkMaaSAIConfig.
go/api/v1alpha2/modelconfig_types.go Adds Spark MaaS provider enum and SparkMaaSAIConfig schema to API types.
go/api/config/crd/bases/kagent.dev_modelproviderconfigs.yaml Extends provider enum in generated base CRD.
go/api/config/crd/bases/kagent.dev_modelconfigs.yaml Extends generated base CRD with Spark MaaS config schema + validations.
go/api/adk/types.go Adds SparkMaaSAI ADK model type + parsing + embedding conversion mapping.
go/api/adk/types_test.go Adds Spark MaaS marshal/unmarshal/type tests.
go/adk/pkg/agent/agent.go Instantiates Spark MaaS LLM using OpenAI-compatible model implementation.
Files not reviewed (1)
  • go/api/v1alpha2/zz_generated.deepcopy.go: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go/core/internal/controller/translator/agent/adk_api_translator.go
Comment thread python/packages/kagent-adk/src/kagent/adk/types.py
Comment thread go/api/adk/types.go Outdated
Comment thread go/api/v1alpha2/modelconfig_types.go
@dongjiang1989 dongjiang1989 force-pushed the add-spark-model branch 2 times, most recently from 95b50ad to cf09f12 Compare May 19, 2026 13:41
Comment thread go/adk/pkg/agent/agent.go
Model: m.Model,
BaseUrl: m.BaseUrl,
}
return models.NewOpenAIModelWithLogger(cfg, log)
Copy link
Copy Markdown
Contributor

@supreme-gg-gg supreme-gg-gg May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is completely OpenAI compatible, wouldn't you be able to use this already with Kagent's BYO OpenAI by just setting the baseUrl, something like this? Could you explain why would we need to add explicit support in the API?

apiVersion: kagent.dev/v1alpha2
kind: ModelConfig
metadata:
  name: my-spark-model
  namespace: kagent
spec:
  apiKeySecret: kagent-my-provider
  apiKeySecretKey: ${PROVIDER_API_KEY}
  model: Spark5.0-Pro
  provider: OpenAI
  openAI:
    baseUrl: "https://maas-api.cn-huabei-1.xf-yun.com.cn"

Copy link
Copy Markdown
Contributor Author

@dongjiang1989 dongjiang1989 May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @supreme-gg-gg

The iFlytek Spark-x model supports the standard WebSocket protocol for model invocation, which is a universal and standard model interaction protocol. I plan to implement access support for it via type configuration, and this is exactly the core motivation and original intention behind submitting this PR.

ref: https://www.xfyun.cn/doc/spark/Web.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: dongjiang <dongjiang1989@126.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants