Skip to content

feat(providers): add Kie provider for Claude, GPT, Grok, and Kimi models - #8391

Merged
waleedlatif1 merged 4 commits into
stagingfrom
feat/kie-provider
Sep 28, 2026
Merged

waleedlatif1 merged 4 commits into
stagingfrom
feat/kie-provider

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add Kie (kie.ai) as a BYOK-only model provider with 22 chat models under a kie/ prefix: Claude (Opus 5.5 → Haiku 4.5), GPT 6 / 5.6 / 5.5, Grok 4.6 / 4.5 / 4.3, and Kimi K3
  • Claude routes through the shared Anthropic core against Kie's Messages proxy (bearer auth); GPT/Grok/Kimi route through the shared Responses core, one endpoint per model family
  • Pricing is Kie's own per-model rate; capabilities mirror the upstream entries, limited to what Kie documents (e.g. reasoning effort low–xhigh)
  • Kie answers most failures with HTTP 200 + { code, msg }; createKieFetch rewrites those into real HTTP errors so bad keys fail fast, rate limits retry, and failures never surface as empty completions
  • Kie defaults stream to true, so the Responses and Anthropic cores now send stream: false explicitly on non-streaming calls (a no-op for OpenAI/Anthropic)
  • ResponsesProviderConfig.capabilityModel lets a reseller's wire slug differ from the catalog id used for reasoning-effort lookup
  • Conversation history protocol can now resolve per model (getProviderHistoryProtocol), since Kie serves both Anthropic and Responses wire formats under one provider
  • BYOK wiring (settings row, contract enum, key resolution), icon, landing catalog, usage icon, tokenization, regenerated agent streaming docs

Type of Change

  • New feature

Testing

  • Live against the Kie API: Grok 4.6/4.5/4.3 and Kimi K3 verified for plain, streaming, reasoning effort, strict JSON output, non-streaming and streaming tool loops, and memory tool replay (conversation-smoke.test.ts responses case); computed cost matches Kie's billed credits
  • All 22 routes × {plain, stream} return clean errors for an invalid key (previously a crash on Claude and a silent empty success on GPT/Grok)
  • Claude and GPT backends on Kie were intermittently unavailable upstream during testing; one Claude response confirmed the Messages wire shape
  • providers/kie/transport.test.ts (reverting the guard turns 6 of 10 red), history-adapters.test.ts, providers/memory/BYOK suites (2,204 tests)
  • bun run lint, check:audits, docs-manifest:check, block registry check, type-check

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 28, 2026 10:34pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 24 files

Confidence score: 4/5

  • In apps/sim/providers/models.ts, accepting arbitrary kie/... IDs as custom models can let unsupported non-Claude IDs pass validation and then fail at execution; restrict the custom namespace to Claude IDs.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/sim/providers/models.ts">

<violation number="1" location="apps/sim/providers/models.ts:3706">
P2: This pattern accepts arbitrary `kie/...` IDs as custom models, but non-Claude IDs must match the fixed Responses endpoint map and otherwise fail at execution. Restrict the custom namespace to Claude IDs; the 11 catalogued GPT/Grok/Kimi IDs still resolve through exact catalog matches.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/providers/models.ts
@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds a new LLM provider integration for Kie.

The PR appears safe to merge; no outstanding findings or accepted new issues remain.

Summary

The PR adds a BYOK-only Kie model provider, routing Claude through the Anthropic Messages core and GPT, Grok, and Kimi through the Responses core. It also adds model catalog and settings support, error-envelope handling, and per-model conversation-history protocol selection.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Request[Agent model request] --> Kie[Kie provider]
  Kie -->|Claude| Anthropic[Anthropic Messages core]
  Kie -->|GPT, Grok, Kimi| Responses[Responses core]
  Anthropic --> Fetch[Kie fetch wrapper]
  Responses --> Fetch
  Fetch --> API[Kie API]
Loading

Reviews (4) · Last reviewed commit: "fix(providers): parse untyped Kie JSON r..."

Comment thread apps/sim/providers/kie/transport.ts
Comment thread apps/sim/providers/kie/index.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 25 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/providers/kie/transport.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 26 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/providers/kie/transport.ts Outdated
Comment thread apps/sim/providers/kie/transport.test.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 26 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 07f3297 into staging Sep 28, 2026
32 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/kie-provider branch September 28, 2026 22:59

This branch was previously deployed

1 inactive deployment
Preview — 1859f19c Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant