support gpt-5.5 api (#487)
This commit is contained in:
parent
a95aa87bf1
commit
4754bbae6d
@ -173,6 +173,7 @@ TAVILY_API_KEY=
|
||||
|
||||
# Optional server-side default model for API routes like /api/generate-classroom
|
||||
# Example: anthropic:claude-3-5-haiku-20241022 or google:gemini-3-flash-preview
|
||||
# OpenAI example: openai:gpt-5.5
|
||||
# MiniMax example: minimax:MiniMax-M2.7-highspeed
|
||||
DEFAULT_MODEL=
|
||||
|
||||
|
||||
@ -121,6 +121,13 @@ providers:
|
||||
|
||||
支持的服务商:**OpenAI**、**Anthropic**、**Google Gemini**、**DeepSeek**、**通义千问 Qwen**、**Kimi**、**MiniMax**、**Grok (xAI)**、**OpenRouter**、**豆包**、**腾讯混元 / TokenHub**、**小米 MiMo**、**智谱 GLM**、**Ollama**(本地)以及任何兼容 OpenAI API 的服务。
|
||||
|
||||
OpenAI 快速示例:
|
||||
|
||||
```env
|
||||
OPENAI_API_KEY=sk-...
|
||||
DEFAULT_MODEL=openai:gpt-5.5
|
||||
```
|
||||
|
||||
MiniMax 快速示例:
|
||||
|
||||
```env
|
||||
|
||||
@ -121,6 +121,13 @@ providers:
|
||||
|
||||
Supported providers: **OpenAI**, **Anthropic**, **Google Gemini**, **DeepSeek**, **Qwen**, **Kimi**, **MiniMax**, **Grok (xAI)**, **OpenRouter**, **Doubao**, **Tencent Hunyuan/TokenHub**, **Xiaomi MiMo**, **GLM (Zhipu)**, **Ollama** (local), and any OpenAI-compatible API.
|
||||
|
||||
OpenAI quick example:
|
||||
|
||||
```env
|
||||
OPENAI_API_KEY=sk-...
|
||||
DEFAULT_MODEL=openai:gpt-5.5
|
||||
```
|
||||
|
||||
MiniMax quick examples:
|
||||
|
||||
```env
|
||||
|
||||
@ -337,8 +337,6 @@ export function ProviderConfigPanel({
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">{t('settings.modelsManagementDescription')}</p>
|
||||
|
||||
<div className="space-y-1.5">
|
||||
{models.map((model, index) => {
|
||||
return (
|
||||
|
||||
@ -90,11 +90,14 @@ function buildDisableThinking(
|
||||
): ProviderOptions | undefined {
|
||||
switch (providerType) {
|
||||
case 'openai': {
|
||||
// GPT-5.1/5.2: support effort=none (fully off)
|
||||
// GPT-5.5: lowest supported effort is low
|
||||
// GPT-5.1/5.2/5.4: support effort=none (fully off)
|
||||
// GPT-5/mini/nano: lowest is minimal
|
||||
// o-series: lowest is low
|
||||
let effort: string;
|
||||
if (modelId.startsWith('gpt-5.')) {
|
||||
if (/^gpt-5\.5(?:-|$)/.test(modelId)) {
|
||||
effort = 'low';
|
||||
} else if (modelId.startsWith('gpt-5.')) {
|
||||
effort = 'none';
|
||||
} else if (modelId.startsWith('gpt-5')) {
|
||||
effort = 'minimal';
|
||||
|
||||
@ -60,6 +60,22 @@ export const PROVIDERS: Record<ProviderId, ProviderConfig> = {
|
||||
requiresApiKey: true,
|
||||
icon: '/logos/openai.svg',
|
||||
models: [
|
||||
{
|
||||
id: 'gpt-5.5',
|
||||
name: 'GPT-5.5',
|
||||
contextWindow: 1050000,
|
||||
outputWindow: 128000,
|
||||
capabilities: {
|
||||
streaming: true,
|
||||
tools: true,
|
||||
vision: true,
|
||||
thinking: {
|
||||
toggleable: false,
|
||||
budgetAdjustable: true,
|
||||
defaultEnabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'gpt-5.4-pro',
|
||||
name: 'GPT-5.4 Pro',
|
||||
|
||||
@ -528,7 +528,6 @@
|
||||
"deleteModel": "حذف",
|
||||
"cancelEdit": "إلغاء",
|
||||
"saveModel": "حفظ",
|
||||
"modelsManagementDescription": "إدارة نماذج هذا المزوّد. لاختيار النموذج النشط، انتقل إلى \"عام\".",
|
||||
"howToUse": "كيفية الاستخدام",
|
||||
"step1ConfigureProvider": "انتقل إلى \"مزوّدو النماذج\"، اختر أو أضف مزوّدًا، وقم بتكوين إعدادات الاتصال (مفتاح API، العنوان الأساسي، إلخ.)",
|
||||
"step2SelectModel": "اختر النموذج الذي تريد استخدامه في \"النموذج النشط\" أدناه",
|
||||
|
||||
@ -529,7 +529,6 @@
|
||||
"deleteModel": "Delete",
|
||||
"cancelEdit": "Cancel",
|
||||
"saveModel": "Save",
|
||||
"modelsManagementDescription": "Manage models for this provider. To select the active model, go to \"General\".",
|
||||
"howToUse": "How to Use",
|
||||
"step1ConfigureProvider": "Go to \"Model Providers\", select or add a provider, and configure connection settings (API key, Base URL, etc.)",
|
||||
"step2SelectModel": "Select the model you want to use in \"Active Model\" below",
|
||||
|
||||
@ -529,7 +529,6 @@
|
||||
"deleteModel": "削除",
|
||||
"cancelEdit": "キャンセル",
|
||||
"saveModel": "保存",
|
||||
"modelsManagementDescription": "このプロバイダーのモデルを管理します。使用するモデルの選択は「一般」から行ってください。",
|
||||
"howToUse": "使い方",
|
||||
"step1ConfigureProvider": "「モデルプロバイダー」でプロバイダーを選択または追加し、接続設定(APIキー、ベースURLなど)を設定します",
|
||||
"step2SelectModel": "下の「使用中のモデル」で使用するモデルを選択します",
|
||||
|
||||
@ -529,7 +529,6 @@
|
||||
"deleteModel": "Удалить",
|
||||
"cancelEdit": "Отмена",
|
||||
"saveModel": "Сохранить",
|
||||
"modelsManagementDescription": "Управление моделями этого провайдера. Чтобы выбрать активную модель, перейдите в «Общие».",
|
||||
"howToUse": "Как использовать",
|
||||
"step1ConfigureProvider": "Перейдите в «Провайдеры моделей», выберите или добавьте провайдера и настройте подключение (API-ключ, Base URL и т.д.)",
|
||||
"step2SelectModel": "Выберите нужную модель в разделе «Активная модель» ниже",
|
||||
|
||||
@ -529,7 +529,6 @@
|
||||
"deleteModel": "删除",
|
||||
"cancelEdit": "取消",
|
||||
"saveModel": "保存",
|
||||
"modelsManagementDescription": "在此管理该提供方的模型列表。若需选择使用的模型,请前往\"常规设置\"。",
|
||||
"howToUse": "使用说明",
|
||||
"step1ConfigureProvider": "前往\"模型提供方\"页面,选择或添加一个提供方,配置连接信息(API 密钥、Base URL 等)",
|
||||
"step2SelectModel": "在下方\"使用模型\"中选择要使用的模型",
|
||||
|
||||
56
tests/ai/openai-provider.test.ts
Normal file
56
tests/ai/openai-provider.test.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const openAiMock = vi.hoisted(() => ({
|
||||
chat: vi.fn((modelId: string) => ({ endpoint: 'chat', modelId })),
|
||||
responses: vi.fn((modelId: string) => ({ endpoint: 'responses', modelId })),
|
||||
createOpenAI: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@ai-sdk/openai', () => ({
|
||||
createOpenAI: openAiMock.createOpenAI,
|
||||
}));
|
||||
|
||||
import { getModel, getModelInfo } from '@/lib/ai/providers';
|
||||
|
||||
describe('OpenAI provider defaults', () => {
|
||||
beforeEach(() => {
|
||||
openAiMock.chat.mockClear();
|
||||
openAiMock.responses.mockClear();
|
||||
openAiMock.createOpenAI.mockReset();
|
||||
openAiMock.createOpenAI.mockReturnValue({
|
||||
chat: openAiMock.chat,
|
||||
responses: openAiMock.responses,
|
||||
});
|
||||
});
|
||||
|
||||
it('includes GPT-5.5 as a built-in OpenAI model', () => {
|
||||
expect(getModelInfo('openai', 'gpt-5.5')).toMatchObject({
|
||||
id: 'gpt-5.5',
|
||||
name: 'GPT-5.5',
|
||||
contextWindow: 1050000,
|
||||
outputWindow: 128000,
|
||||
capabilities: {
|
||||
streaming: true,
|
||||
tools: true,
|
||||
vision: true,
|
||||
thinking: {
|
||||
toggleable: false,
|
||||
budgetAdjustable: true,
|
||||
defaultEnabled: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('routes GPT-5.5 through the OpenAI Responses API', () => {
|
||||
const { model } = getModel({
|
||||
providerId: 'openai',
|
||||
modelId: 'gpt-5.5',
|
||||
apiKey: 'sk-test',
|
||||
});
|
||||
|
||||
expect(openAiMock.responses).toHaveBeenCalledWith('gpt-5.5');
|
||||
expect(openAiMock.chat).not.toHaveBeenCalled();
|
||||
expect(model).toEqual({ endpoint: 'responses', modelId: 'gpt-5.5' });
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user