feat: add Moonshot AI (Kimi) provider and update xAI Grok models (#1953)

- Add comprehensive Moonshot AI provider with 11 models including:
  * Legacy moonshot-v1 series (8k, 32k, 128k context)
  * Latest Kimi K2 models (K2 Preview, Turbo, Thinking)
  * Vision-enabled models for multimodal capabilities
  * Auto-selecting model variants

- Update xAI provider with latest Grok models:
  * Add Grok 4 (256K context) and Grok 4 (07-09) variant
  * Add Grok 3 Mini Beta and Mini Fast Beta variants
  * Update context limits to match actual model capabilities
  * Remove outdated grok-beta and grok-2-1212 models

- Add MOONSHOT_API_KEY to environment configuration
- Register Moonshot provider in service status monitoring
- Full OpenAI-compatible API integration via api.moonshot.ai
- Fix TypeScript errors in GitHub provider

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Stijnus
2025-08-31 18:54:14 +02:00
committed by GitHub
parent 56f5d6f68c
commit df242a7935
18 changed files with 810 additions and 192 deletions

View File

@@ -8,7 +8,7 @@ import { motion } from 'framer-motion';
import { classNames } from '~/utils/classNames';
import { toast } from 'react-toastify';
import { providerBaseUrlEnvKeys } from '~/utils/constants';
import { SiAmazon, SiGoogle, SiHuggingface, SiPerplexity, SiOpenai } from 'react-icons/si';
import { SiAmazon, SiGoogle, SiGithub, SiHuggingface, SiPerplexity, SiOpenai } from 'react-icons/si';
import { BsRobot, BsCloud } from 'react-icons/bs';
import { TbBrain, TbCloudComputing } from 'react-icons/tb';
import { BiCodeBlock, BiChip } from 'react-icons/bi';
@@ -21,6 +21,7 @@ type ProviderName =
| 'Anthropic'
| 'Cohere'
| 'Deepseek'
| 'Github'
| 'Google'
| 'Groq'
| 'HuggingFace'
@@ -38,6 +39,7 @@ const PROVIDER_ICONS: Record<ProviderName, IconType> = {
Anthropic: FaBrain,
Cohere: BiChip,
Deepseek: BiCodeBlock,
Github: SiGithub,
Google: SiGoogle,
Groq: BsCloud,
HuggingFace: SiHuggingface,
@@ -53,6 +55,7 @@ const PROVIDER_ICONS: Record<ProviderName, IconType> = {
// Update PROVIDER_DESCRIPTIONS to use the same type
const PROVIDER_DESCRIPTIONS: Partial<Record<ProviderName, string>> = {
Anthropic: 'Access Claude and other Anthropic models',
Github: 'Use OpenAI models hosted through GitHub infrastructure',
OpenAI: 'Use GPT-4, GPT-3.5, and other OpenAI models',
};

View File

@@ -13,6 +13,7 @@ import { OpenRouterStatusChecker } from './providers/openrouter';
import { PerplexityStatusChecker } from './providers/perplexity';
import { TogetherStatusChecker } from './providers/together';
import { XAIStatusChecker } from './providers/xai';
import { MoonshotStatusChecker } from './providers/moonshot';
export class ProviderStatusCheckerFactory {
private static _providerConfigs: Record<ProviderName, ProviderConfig> = {
@@ -82,6 +83,12 @@ export class ProviderStatusCheckerFactory {
headers: {},
testModel: 'mistralai/Mixtral-8x7B-Instruct-v0.1',
},
Moonshot: {
statusUrl: 'https://status.moonshot.ai/',
apiUrl: 'https://api.moonshot.ai/v1/models',
headers: {},
testModel: 'moonshot-v1-8k',
},
XAI: {
statusUrl: 'https://status.x.ai/',
apiUrl: 'https://api.x.ai/v1/models',
@@ -120,6 +127,8 @@ export class ProviderStatusCheckerFactory {
return new PerplexityStatusChecker(config);
case 'Together':
return new TogetherStatusChecker(config);
case 'Moonshot':
return new MoonshotStatusChecker(config);
case 'XAI':
return new XAIStatusChecker(config);
default:

View File

@@ -0,0 +1,37 @@
import { BaseProviderChecker } from '~/components/@settings/tabs/providers/service-status/base-provider';
import type { StatusCheckResult } from '~/components/@settings/tabs/providers/service-status/types';
export class MoonshotStatusChecker extends BaseProviderChecker {
async checkStatus(): Promise<StatusCheckResult> {
try {
// Check Moonshot API endpoint
const apiEndpoint = 'https://api.moonshot.ai/v1/models';
const apiStatus = await this.checkEndpoint(apiEndpoint);
// Check their main website
const websiteStatus = await this.checkEndpoint('https://www.moonshot.ai');
let status: StatusCheckResult['status'] = 'operational';
let message = 'All systems operational';
if (apiStatus !== 'reachable' || websiteStatus !== 'reachable') {
status = apiStatus !== 'reachable' ? 'down' : 'degraded';
message = apiStatus !== 'reachable' ? 'API appears to be down' : 'Service may be experiencing issues';
}
return {
status,
message,
incidents: [], // No public incident tracking available yet
};
} catch (error) {
console.error('Error checking Moonshot status:', error);
return {
status: 'degraded',
message: 'Unable to determine service status',
incidents: ['Note: Limited status information available'],
};
}
}
}

View File

@@ -9,6 +9,7 @@ export type ProviderName =
| 'HuggingFace'
| 'Hyperbolic'
| 'Mistral'
| 'Moonshot'
| 'OpenRouter'
| 'Perplexity'
| 'Together'