cloudflare / cloudflare/cloudflare-os
Support DeepSeek and xAI Grok as first-class AI providers
- Dominant language
- TypeScript
- Stars
- 9.9k
- Forks
- 1.2k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 107
Description
## Summary
Add first-class AI provider support for DeepSeek and xAI Grok.
Cloudflare OS currently supports a fixed set of providers and allows custom model IDs under those providers, but DeepSeek and xAI/Grok are not represented as providers in the UI or in the provider type/routing layer. Users can sometimes work around this through the generic OpenAI-compatible path, but that does not provide a clear provider-specific setup or guarantee compatibility with the request format used by the agent loop.
## Why
Both services expose OpenAI-compatible APIs:
- DeepSeek: `https://api.deepseek.com`
- xAI: `https://api.x.ai/v1`
References:
- https://api-docs.deepseek.com/zh-cn/guides/function_calling/
- https://x.ai/
Adding them as first-class providers would make setup discoverable and allow provider-specific model metadata and compatibility handling.
## Proposed scope
- Add `deepseek` and `xai` to `AiModelProvider`.
- Add provider labels, default API URLs, API-token hints, and suggested/current model IDs.
- Route both providers through the appropriate `pi-ai` streaming adapter.
- Preserve support for custom model IDs.
- Verify streaming responses, tool calls, reasoning output, image capability metadata, and multi-turn agent runs.
- Add unit/integration coverage with mocked provider endpoints.
- Keep the existing generic OpenAI-compatible configuration working unchanged.
If maintaining two separate provider types is undesirable, a generic OpenAI-compatible provider with DeepSeek and xAI presets would also solve the setup/discoverability problem.
## Acceptance criteria
- A user can select DeepSeek or xAI/Grok from **AI Providers** without pretending it is OpenAI.
- The default endpoint and credential instructions are shown automatically, while allowing an API URL override where appropriate.
- At least one current DeepSeek model and one current Grok model can complete a normal chat and an agent tool-call loop.
- Model capability metadata prevents unsupported attachments or features from being sent.
- Existing OpenAI, Anthropic, Google, Cloudflare Workers AI, and Ollama configurations are not regressed.
Contributor guide
Research direction
Start by locating the AiModelProvider type, AI Providers UI, provider routing layer, and the pi-ai streaming adapter path. Review the existing generic OpenAI-compatible configuration and add mocked provider endpoint coverage for streaming, tool calls, reasoning, image metadata, and multi-turn agent runs. Done means DeepSeek and xAI/Grok are selectable with defaults and overrides while existing providers remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100