💄 style: add grok-4-0709 model from xAI (#8379)

* 💄 style: add `grok-4-0709` model from xAI

* 🐛 fix: fix model calling

* 🐛 fix: remove `reasoning_effort` support for Grok 4
This commit is contained in:
Zhijie He
2025-07-10 15:40:50 +08:00
committed by GitHub
parent e11bf29d0f
commit b7ca447946
2 changed files with 32 additions and 3 deletions
+25 -1
View File
@@ -2,6 +2,31 @@ import { AIChatModelCard } from '@/types/aiModel';
// https://docs.x.ai/docs/models
const xaiChatModels: AIChatModelCard[] = [
{
abilities: {
functionCall: true,
reasoning: true,
search: true,
},
contextWindowTokens: 256_000,
description:
'我们最新最强大的旗舰模型,在自然语言处理、数学计算和推理方面表现卓越 —— 是一款完美的全能型选手。',
displayName: 'Grok 4 0709',
enabled: true,
id: 'grok-4-0709',
pricing: {
cachedInput: 0.75,
input: 3,
output: 15,
},
releasedAt: '2025-07-09',
settings: {
// reasoning_effort is not supported by grok-4. Specifying reasoning_effort parameter will get an error response.
// extendParams: ['reasoningEffort'],
searchImpl: 'params',
},
type: 'chat',
},
{
abilities: {
functionCall: true,
@@ -11,7 +36,6 @@ const xaiChatModels: AIChatModelCard[] = [
description:
'旗舰级模型,擅长数据提取、编程和文本摘要等企业级应用,拥有金融、医疗、法律和科学等领域的深厚知识。',
displayName: 'Grok 3',
enabled: true,
id: 'grok-3',
pricing: {
cachedInput: 0.75,
+7 -2
View File
@@ -7,6 +7,11 @@ export interface XAIModelCard {
id: string;
}
export const GrokReasoningModels = new Set([
'grok-3-mini',
'grok-4-0709',
]);
export const LobeXAI = createOpenAICompatibleRuntime({
baseURL: 'https://api.x.ai/v1',
chatCompletion: {
@@ -15,9 +20,9 @@ export const LobeXAI = createOpenAICompatibleRuntime({
return {
...rest,
frequency_penalty: model.includes('grok-3-mini') ? undefined : frequency_penalty,
frequency_penalty: GrokReasoningModels.has(model) ? undefined : frequency_penalty,
model,
presence_penalty: model.includes('grok-3-mini') ? undefined : presence_penalty,
presence_penalty: GrokReasoningModels.has(model) ? undefined : presence_penalty,
stream: true,
...(enabledSearch && {
search_parameters: {