Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🚚 refactor(model-runtime): rename openaiCompatibleFactory to openaiCompatible (#22778)

Arvin Xu4cb6e7b23733
diff --git a/.agents/skills/deep-review/references/dimensions/reuse-architecture.md b/.agents/skills/deep-review/references/dimensions/reuse-architecture.md
index 4dbf13f8173..65975d34b2c 100644
--- a/.agents/skills/deep-review/references/dimensions/reuse-architecture.md
+++ b/.agents/skills/deep-review/references/dimensions/reuse-architecture.md
@@ -61,7 +61,7 @@ Three passes — precedent, outward, inward:
1. Identify the pipeline and list the candidate layers where this fix could live.
2. Ask: is the root cause specific to one variant (one provider, one platform, one client) or common to the whole class?
-3. Variant-specific → the fix belongs in the variant's own layer: a DeepSeek parameter quirk goes in `packages/model-runtime/src/providers/deepseek/`, not in the shared `core/openaiCompatibleFactory/` where it would branch for every provider. Class-wide → the fix belongs in the shared layer, not replicated at one call site.
+3. Variant-specific → the fix belongs in the variant's own layer: a DeepSeek parameter quirk goes in `packages/model-runtime/src/providers/deepseek/`, not in the shared `core/openaiCompatible/` where it would branch for every provider. Class-wide → the fix belongs in the shared layer, not replicated at one call site.
4. Check the shared layer's existing extension points first (factory options, hooks, per-variant config) — the repo usually already provides a seam for variant behavior; adding an `if (variant === ...)` branch to shared code when a seam exists is the violation.
Large-repo fallback: if a single `rg` exceeds \~30s, restrict to the changed files' top-level directories plus the default reuse sources.
diff --git a/docs/development/basic/add-new-image-model.mdx b/docs/development/basic/add-new-image-model.mdx
index 57af68f1079..0586584293e 100644
--- a/docs/development/basic/add-new-image-model.mdx
+++ b/docs/development/basic/add-new-image-model.mdx
@@ -65,7 +65,7 @@ For image generation models that are not compatible with OpenAI format, you need
### Method 1: Using OpenAI Compatible Factory
-Most Providers use `openaiCompatibleFactory` for OpenAI compatibility. You can pass in a custom `createImage` function (reference [PR #8534](https://github.com/lobehub/lobehub/pull/8534)).
+Most Providers use `createOpenAICompatibleRuntime` for OpenAI compatibility. You can pass in a custom `createImage` function (reference [PR #8534](https://github.com/lobehub/lobehub/pull/8534)).
**Implementation Steps**:
@@ -113,7 +113,7 @@ export const createProviderImage = async (
```ts
// packages/model-runtime/src/providers/<provider-name>/index.ts
-export const LobeProviderAI = openaiCompatibleFactory({
+export const LobeProviderAI = createOpenAICompatibleRuntime({
constructorOptions: {
// ... other configurations
},
diff --git a/docs/development/basic/add-new-image-model.zh-CN.mdx b/docs/development/basic/add-new-image-model.zh-CN.mdx
index 0e300b1e434..a50e090c84c 100644
--- a/docs/development/basic/add-new-image-model.zh-CN.mdx
+++ b/docs/development/basic/add-new-image-model.zh-CN.mdx
@@ -63,7 +63,7 @@ export const zhipuImageModels: AIImageModelCard[] = [
### 方式一:使用 OpenAI Compatible Factory
-大部分 Provider 都使用 `openaiCompatibleFactory` 来兼容 OpenAI,可以通过传入自定义的 `createImage` 函数(参考 [PR #8534](https://github.com/lobehub/lobehub/pull/8534))。
+大部分 Provider 都使用 `createOpenAICompatibleRuntime` 来兼容 OpenAI,可以通过传入自定义的 `createImage` 函数(参考 [PR #8534](https://github.com/lobehub/lobehub/pull/8534))。
**实现步骤**:
@@ -111,7 +111,7 @@ export const createProviderImage = async (
```ts
// packages/model-runtime/src/providers/<provider-name>/index.ts
-export const LobeProviderAI = openaiCompatibleFactory({
+export const LobeProviderAI = createOpenAICompatibleRuntime({
constructorOptions: {
// ... 其他配置
},
diff --git a/docs/development/basic/chat-api.mdx b/docs/development/basic/chat-api.mdx
index 6b05e7018ff..37ac4646f4b 100644
--- a/docs/development/basic/chat-api.mdx
+++ b/docs/development/basic/chat-api.mdx
@@ -397,8 +397,8 @@ export interface LobeRuntimeAI {
```
**Adapter Architecture**: Through two factory functions —
-`openaiCompatibleFactory` and
-`anthropicCompatibleFactory` — most providers can be
+`createOpenAICompatibleRuntime` and
+`createAnthropicCompatibleRuntime` — most providers can be
integrated with minimal configuration. Currently supports
over 40 model providers (OpenAI, Anthropic, Google,
Azure, Bedrock, Ollama, etc.), with implementations
diff --git a/docs/development/basic/chat-api.zh-CN.mdx b/docs/development/basic/chat-api.zh-CN.mdx
index 5fa65ce9907..f79d939de0a 100644
--- a/docs/development/basic/chat-api.zh-CN.mdx
+++ b/docs/development/basic/chat-api.zh-CN.mdx
@@ -361,8 +361,8 @@ export interface LobeRuntimeAI {
}
```
-**适配器架构**:通过 `openaiCompatibleFactory` 和
-`anthropicCompatibleFactory` 两种工厂函数,
+**适配器架构**:通过 `createOpenAICompatibleRuntime` 和
+`createAnthropicCompatibleRuntime` 两种工厂函数,
大多数提供商只需少量配置即可接入。
目前支持超过 40 个模型提供商
(OpenAI、Anthropic、Google、Azure、Bedrock、Ollama 等),
diff --git a/packages/model-runtime/CLAUDE.md b/packages/model-runtime/CLAUDE.md
deleted file mode 100644
index b4a0ec4f004..00000000000
--- a/packages/model-runtime/CLAUDE.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Model Runtime Package
-
-## Testing
-
-For detailed test coverage status, testing strategies, and implementation guidelines, see [Test Coverage Documentation](./docs/test-coverage.md).
diff --git a/packages/model-runtime/docs/test-coverage.md b/packages/model-runtime/docs/test-coverage.md
deleted file mode 100644
index 71596e084a4..00000000000
--- a/packages/model-runtime/docs/test-coverage.md
+++ /dev/null
@@ -1,706 +0,0 @@
-# Model Runtime Testing Coverage
-
-## Current Status
-
-**Overall Coverage**: 94.36% (117 test files, 2683 tests) 🎉 **TARGET ACHIEVED!**
-
-**Breakdown:**
-
-- Statements: 94.36%
-- Branches: 89.86%
-- Functions: 93.8%
-- Lines: 94.36%
-
-## Coverage Status by Priority
-
-### 🔴 Critical - Low Coverage (<50%)
-
-**None** - All critical files have been improved to 90%+ coverage! 🎉
-
-### 🟡 Medium - Moderate Coverage (80-90%)
-
-| File | Coverage | Priority | Notes |
-| ---------------------------------------------- | -------- | -------- | ------------------------ |
-| **Core Modules** | | | |
-| core/streams/openai/responsesStream.ts | 91.56% | Low | Remaining: error catches |
-| core/openaiCompatibleFactory/index.ts | 83.72% | Low | Complex factory logic |
-| core/usageConverters/utils/computeChatCost.ts | 95.74% | Low | Edge case scenarios |
-| core/usageConverters/utils/computeImageCost.ts | 96.05% | Low | Edge case scenarios |
-| core/streams/openai/openai.ts | 98.79% | Low | Excellent coverage |
-| **Providers** | | | |
-| providers/openai | 87.5% | Low | Env vars at module load |
-| providers/azureOpenai | 85.15% | Low | Custom auth flow |
-| providers/azureai | 84.31% | Low | Azure-specific features |
-| providers/anthropic | 88.44% | Low | Provider-specific logic |
-
-### ✅ Excellent - High Coverage (90%+)
-
-**65+ providers and core modules with 90%+ coverage**, including:
-
-- **100% coverage**: deepseek, nvidia, qiniu, wenxin, giteeai, v0, zeroone, ai360, akashchat, baichuan, bedrock, cohere, mistral, moonshot, ollama, openrouter, search1api, sensenova, spark, zhipu, vercelaigateway, cometapi, cerebras, ollamacloud, internlm, hunyuan, huggingface, groq, modelscope, nebius, stepfun, lmstudio, newapi, fireworksai, jina, tencentcloud, togetherai, ai21, sambanova, upstage, vllm
-- **95-99%**: ModelRuntime, computeChatCost, computeImageCost, openai streams, createImage, github, vertexai, volcengine, siliconcloud, ppio, minimax, cloudflare, fal
-- **90-94%**: contextBuilders, streams (anthropic, protocol, qwen), openai provider
-
-**Good - Coverage (80-89%)**:
-
-- ai302, qwen, google, azureOpenai, azureai, infiniai, aihubmix, bfl, anthropic, openai, RouterRuntime
-
-## Testing Strategy
-
-### 1. Provider Testing Pattern
-
-All providers should follow this testing pattern:
-
-```typescript
-// @vitest-environment node
-import { ModelProvider } from 'model-bank';
-import { beforeEach, describe, expect, it, vi } from 'vitest';
-
-import { testProvider } from '../../providerTestUtils';
-import { LobeXxxAI, params } from './index';
-
-// Basic provider tests
-testProvider({
- Runtime: LobeXxxAI,
- provider: ModelProvider.Xxx,
- defaultBaseURL: 'https://api.xxx.com/v1',
- chatDebugEnv: 'DEBUG_XXX_CHAT_COMPLETION',
- chatModel: 'model-name',
- invalidErrorType: 'InvalidProviderAPIKey',
- bizErrorType: 'ProviderBizError',
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
-// Custom feature tests
-describe('LobeXxxAI - custom features', () => {
- let instance: InstanceType<typeof LobeXxxAI>;
-
- beforeEach(() => {
- instance = new LobeXxxAI({ apiKey: 'test_api_key' });
- vi.spyOn(instance['client'].chat.completions, 'create').mockResolvedValue(
- new ReadableStream() as any,
- );
- });
-
- describe('handlePayload', () => {
- // Test custom payload transformations
- });
-
- describe('handleError', () => {
- // Test custom error handling
- });
-
- describe('models', () => {
- // Test models fetching and processing
- });
-});
-```
-
-### 2. Code Refactoring Pattern
-
-#### 2.1 OpenAI-Compatible Provider Pattern
-
-For better testability, OpenAI-compatible providers should export a `params` object:
-
-```typescript
-import {
- OpenAICompatibleFactoryOptions,
- createOpenAICompatibleRuntime,
-} from '../../core/openaiCompatibleFactory';
-
-export const params = {
- baseURL: 'https://api.example.com/v1',
- chatCompletion: {
- handlePayload: (payload) => {
- // Custom payload transformation
- return transformedPayload;
- },
- handleError: (error) => {
- // Custom error handling
- return errorResponse;
- },
- },
- debug: {
- chatCompletion: () => process.env.DEBUG_XXX_CHAT_COMPLETION === '1',
- },
- models: async ({ client }) => {
- // Fetch and process models
- return modelList;
- },
- provider: ModelProvider.Xxx,
-} satisfies OpenAICompatibleFactoryOptions;
-
-export const LobeXxxAI = createOpenAICompatibleRuntime(params);
-```
-
-#### 2.2 Router Provider Pattern
-
-Router providers (like NewAPI and AiHubMix) route different models to different API types. They should also export a `params` object:
-
-```typescript
-import { ModelProvider } from 'model-bank';
-
-import { createRouterRuntime } from '../../core/RouterRuntime';
-import { CreateRouterRuntimeOptions } from '../../core/RouterRuntime/createRuntime';
-
-export const params = {
- id: ModelProvider.Xxx,
- debug: {
- chatCompletion: () => process.env.DEBUG_XXX_CHAT_COMPLETION === '1',
- },
- defaultHeaders: {
- 'X-Custom-Header': 'value',
- },
- models: async ({ client }) => {
- // Fetch and process multi-provider model list
- const modelsPage = await client.models.list();
- return processMultiProviderModelList(modelsPage.data, 'xxx');
- },
- routers: [
- {
- apiType: 'anthropic',
- models: LOBE_DEFAULT_MODEL_LIST.filter((m) => detectModelProvider(m.id) === 'anthropic'),
- options: { baseURL: 'https://api.xxx.com' },
- },
- {
- apiType: 'google',
- models: LOBE_DEFAULT_MODEL_LIST.filter((m) => detectModelProvider(m.id) === 'google'),
- options: { baseURL: 'https://api.xxx.com/gemini' },
- },
- {
- apiType: 'openai',
- options: {
- baseURL: 'https://api.xxx.com/v1',
- chatCompletion: {
- handlePayload: (payload) => {
- // Custom payload transformation for OpenAI-compatible models
- return payload;
- },
- },
- },
- },
- ],
-} satisfies CreateRouterRuntimeOptions;
-
-export const LobeXxxAI = createRouterRuntime(params);
-```
-
-**Key Differences for Router Providers:**
-
-- Use `createRouterRuntime` instead of `createOpenAICompatibleRuntime`
-- Define `routers` array to specify how different models route to different API types
-- Each router can have its own `apiType`, `models` filter, and `options`
-- The `models` function should use `processMultiProviderModelList` to handle multi-provider model lists
-
-### 3. Testing Checklist
-
-#### 3.1 OpenAI-Compatible Provider Checklist
-
-For each OpenAI-compatible provider, ensure:
-
-- [ ] Basic initialization tests (via `testProvider`)
-- [ ] Debug mode tests
-- [ ] Payload transformation tests (if custom `handlePayload`)
-- [ ] Error handling tests (if custom `handleError`)
-- [ ] Models fetching tests (if custom `models`)
-- [ ] Special features tests (web search, thinking, etc.)
-- [ ] Edge cases and boundary conditions
-- [ ] Export `params` object for better testability
-
-#### 3.2 Router Provider Testing Checklist
-
-For router providers (like NewAPI, AiHubMix), ensure:
-
-- [ ] **Basic Runtime Tests**
- - Runtime instantiation with correct provider ID
- - Type definitions for provider-specific interfaces
-- [ ] **Debug Configuration Tests**
- - Debug mode enabled (`DEBUG_XXX_CHAT_COMPLETION=1`)
- - Debug mode disabled (default)
-- [ ] **Router Configuration Tests**
- - Dynamic routers generation (if using function form)
- - Correct baseURL extraction and processing
- - Per-router apiType and model filtering
- - Per-router options configuration
-- [ ] **Models Function Tests**
- - Successful model list fetching
- - `processMultiProviderModelList` integration
- - Error handling (network errors, invalid API keys)
- - Empty or missing model data handling
-- [ ] **Custom Logic Tests** (if applicable)
- - Custom payload transformations (e.g., `handlePayload` in OpenAI router)
- - Custom pricing calculation logic
- - Provider detection from model metadata
- - URL processing and normalization
-- [ ] **Edge Cases**
- - Missing or invalid baseURL
- - Empty model lists
- - API errors and fallback behavior
- - Special model patterns (e.g., Responses API detection)
-- [ ] **Export Requirements**
- - Export `params` object satisfying `CreateRouterRuntimeOptions`
- - Export custom types (ModelCard, Pricing, etc.)
- - Export utility functions for testing (e.g., `handlePayload`)
-
-#### 3.3 Router Provider Testing Example
-
-Reference: `newapi/index.test.ts`
-
-```typescript
-// @vitest-environment node
-import { describe, expect, it } from 'vitest';
-
-import { LobeXxxAI, params } from './index';
-
-describe('Xxx Router Runtime', () => {
- describe('Runtime Instantiation', () => {
- it('should create runtime instance', () => {
- const instance = new LobeXxxAI({ apiKey: 'test' });
- expect(instance).toBeDefined();
- });
- });
-
- describe('Debug Configuration', () => {
- it('should disable debug by default', () => {
- delete process.env.DEBUG_XXX_CHAT_COMPLETION;
- const result = params.debug.chatCompletion();
- expect(result).toBe(false);
- });
-
- it('should enable debug when env is set', () => {
- process.env.DEBUG_XXX_CHAT_COMPLETION = '1';
- const result = params.debug.chatCompletion();
- expect(result).toBe(true);
- });
- });
-
- describe('Routers Configuration', () => {
- it('should configure routers with correct apiTypes', () => {
- // Test static routers
- const routers = params.routers;
- expect(routers).toHaveLength(4);
- expect(routers[0].apiType).toBe('anthropic');
- expect(routers[1].apiType).toBe('google');
- expect(routers[2].apiType).toBe('xai');
- expect(routers[3].apiType).toBe('openai');
- });
-
- it('should configure dynamic routers with user baseURL', () => {
- // Test dynamic routers function
- const options = { apiKey: 'test', baseURL: 'https://custom.com/v1' };
- const routers = params.routers(options);
- expect(routers[0].options.baseURL).toContain('custom.com');
- });
- });
-
- describe('Models Function', () => {
- it('should fetch and process models', async () => {
- // Test models fetching logic
- const mockClient = {
- baseURL: 'https://api.xxx.com/v1',
- apiKey: 'test',
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'model-1', owned_by: 'openai' }],
- }),
- },
- };
-
- const models = await params.models({ client: mockClient });
- expect(models).toBeDefined();
- });
-
- it('should handle API errors gracefully', async () => {
- // Test error handling
- const mockClient = {
- models: {
- list: vi.fn().mockRejectedValue(new Error('API Error')),
- },
- };
-
- const models = await params.models({ client: mockClient });
- expect(models).toEqual([]);
- });
- });
-});
-```
-
-### 4. Complete Testing Workflow
-
-**IMPORTANT**: Follow this complete workflow for every testing task. ALL steps are REQUIRED.
-
-#### Step 0: Use Subagents for Parallel Execution (Recommended)
-
-**For multiple providers**: Use subagents to parallelize test development and significantly speed up the process.
-
-**Benefits of using subagents:**
-
-- ⚡ **Speed**: 5 providers completed in parallel vs. sequential (\~5x faster)
-- 🔄 **Isolation**: Each provider's tests developed independently
-- 📊 **Progress tracking**: See all provider progress at once
-- 🐛 **Early detection**: Identify common issues across providers
-
-**How to create parallel subagents:**
-
-When working on multiple providers, create one subagent per provider with a detailed prompt like:
-
-```
-根据 model-runtime 内部的测试文档,补充以下 5 个 provider 的测试,每个 provider 的测试用独立的 subagent 执行,这样可以并发加速。
-
-请为以下 providers 分别创建 subagent:
-- internlm (current: 39.13%, target: 80%+)
-- hunyuan (current: 39.68%, target: 80%+)
-- huggingface (current: 39.75%, target: 80%+)
-- groq (current: 45.45%, target: 80%+)
-- modelscope (current: 47.82%, target: 80%+)
-```
-
-Each subagent should be instructed to:
-
-1. Read the test documentation (`packages/model-runtime/docs/test-coverage.md`)
-2. Read the implementation file and test file
-3. Analyze missing tests based on the testing checklist
-4. Add tests and verify they pass
-5. Return a summary of test results (do NOT run type check or coverage)
-
-**After all subagents complete:**
-
-- Review all test results
-- Fix any failed tests (e.g., type errors, test failures)
-- Proceed with Step 2 (Type Check) below
-
-**For single provider**: Skip this step and proceed directly to Step 1.
-
----
-
-#### Step 1: Development and Testing
-
-```bash
-# 1. Refactor provider and write tests
-# 2. Run tests to verify they pass
-bunx vitest run --silent='passed-only' 'src/providers/{provider}/index.test.ts'
-```
-
-#### Step 2: Type and Lint Checks
-
-**CRITICAL**: Run type check and lint before proceeding. Failing these checks means the task is incomplete.
-
-```bash
-# Check TypeScript types (from project root)
-cd ../../../ && bun run type-check
-
-# Or run type-check for model-runtime only
-bunx tsc --noEmit
-
-# Fix any linting issues
-bunx eslint src/providers/{provider}/ --fix
-```
-
-**Common Type Errors to Watch For:**
-
-- Missing or incorrect type annotations
-- Unused variables or imports
-- Incorrect generic type parameters
-- Missing satisfies clauses for `params` objects
-
-**Do NOT proceed to Step 3 if type/lint checks fail!**
-
-#### Step 3: Run Coverage Report
-
-```bash
-# Run coverage to get updated metrics
-bunx vitest run --coverage --silent='passed-only'
-```
-
-#### Step 4: Summarize Development Work
-
-Before updating documentation, create a summary of what was accomplished:
-
-**Summary Checklist:**
-
-- [ ] What provider(s) were worked on?
-- [ ] What was the coverage improvement? (before% → after%)
-- [ ] How many new tests were added?
-- [ ] What specific features/logic were tested?
-- [ ] Were any bugs discovered and fixed?
-- [ ] Any new patterns or best practices identified?
-- [ ] Should the testing guide be updated based on learnings?
-
-**Example Summary:**
-
-```
-Provider: newapi
-Coverage: 13.28% → 100% (+86.72%)
-Tests Added: 65 new tests
-Features Tested:
- - handlePayload logic with Responses API detection
- - Complex pricing calculation (quota_type, model_price, model_ratio)
- - Provider detection from supported_endpoint_types and owned_by
- - Dynamic routers configuration with baseURL processing
- - Error handling for pricing API failures
-Bugs Fixed: None
-Guide Updates: Added router provider testing pattern to documentation
-```
-
-#### Step 5: Update This Document
-
-Based on your development summary, update the following sections:
-
-1. **Current Status** section:
- - Update overall coverage percentage
- - Update test file count and total test count
-
-2. **Coverage Status by Priority** section:
- - Move completed providers from low/medium to high coverage section
- - Update coverage percentages for all modified providers
- - Remove completed items from critical/medium sections
-
-3. **Completed Work** section:
- - Update "Recent Achievements" with new coverage delta
- - Add newly refactored providers to the list with their coverage improvement
- - Document any bugs fixed or improvements made
-
-4. **Testing Strategy** section (if applicable):
- - Add new patterns discovered during development
- - Update examples with better practices
- - Document any provider-specific testing approaches
-
-#### Step 6: Final Verification
-
-```bash
-# Verify all tests still pass
-bunx vitest run --silent='passed-only' 'src/providers/{provider}/index.test.ts'
-
-# Verify type check still passes
-cd ../../../ && bun run type-check
-```
-
-#### Complete Workflow Example
-
-```bash
-# 1. Development Phase
-# ... write code and tests ...
-bunx vitest run --silent='passed-only' 'src/providers/example/index.test.ts'
-
-# 2. Type/Lint Phase (REQUIRED)
-cd ../../../ && bun run type-check # Must pass!
-bunx eslint src/providers/example/ --fix
-
-# 3. Coverage Phase
-cd packages/model-runtime
-bunx vitest run --coverage --silent='passed-only'
-
-# 4. Summarization Phase
-# Create summary following the checklist above
-
-# 5. Documentation Phase
-# Update this file with summary and metrics
-
-# 6. Final Verification
-bunx vitest run --silent='passed-only' 'src/providers/example/index.test.ts'
-cd ../../../ && bun run type-check
-
-# 7. Commit
-git add .
-git commit -m "✅ test: add comprehensive tests for example provider (13% → 100%)"
-```
-
-**Remember**: A testing task is only complete when:
-
-1. ✅ Tests pass
-2. ✅ Type check passes
-3. ✅ Lint passes
-4. ✅ Development work is summarized
-5. ✅ Documentation is updated
-6. ✅ Final verification passes
-
-## Commands
-
-### Testing Commands
-
-```bash
-# Run all tests with coverage
-bunx vitest run --coverage
-
-# Run specific provider tests
-bunx vitest run --silent='passed-only' 'src/providers/{provider}/index.test.ts'
-
-# Run tests for multiple providers
-bunx vitest run --silent='passed-only' src/providers/higress/index.test.ts src/providers/ai360/index.test.ts
-
-# Watch mode for development
-bunx vitest watch 'src/providers/{provider}/index.test.ts'
-```
-
-### Type Check Commands
-
-```bash
-# Type check entire project (from project root)
-cd ../../../ && bun run type-check
-
-# Type check model-runtime only
-bunx tsc --noEmit
-
-# Type check with watch mode
-bunx tsc --noEmit --watch
-```
-
-### Lint Commands
-
-```bash
-# Lint specific provider
-bunx eslint src/providers/{provider}/ --fix
-
-# Lint all providers
-bunx eslint src/providers/ --fix
-
-# Lint without auto-fix (check only)
-bunx eslint src/providers/{provider}/
-```
-
-## Completed Work
-
-### Recent Achievements ✅
-
-**Latest Session (2025-10-13 - Part 4)**: 🚀 **Achieved 94.36% Overall Coverage - 95% Goal Nearly Reached!**
-
-- Overall coverage: 91.1% → **94.36% (+3.26%)**
-
-- **Comprehensive Core Module and Provider Enhancement**
-
-- Enhanced 14 files with significant test improvements:
-
- **Core Modules (6 files, +96 tests):**
- - **responsesStream.ts** (50.6% → 91.56%) - 19 tests, response events, function calls, reasoning, citations
- - **createImage.ts** (54.76% → 100%) - 24 tests, chat model mode, image mode, routing logic
- - **computeImageCost.ts** (64.47% → 100%) - 12 tests, lookup/fixed/tiered pricing strategies
- - **openai.ts** (73.87% → 98.79%) - 19 tests, image handling, tool calls, citations, reasoning
- - **ModelRuntime.ts** (75% → 100%) - 12 tests, embeddings, textToSpeech, pullModel, generateObject
- - **computeChatCost.ts** (79.78% → 95.74%) - 10 tests, tiered pricing, error handling
-
- **Providers (8 providers, +102 tests):**
- - **deepseek** (77.77% → 100%) - 9 tests, models function, generateObject config
- - **nvidia** (78.12% → 100%) - 14 tests, thinking mode handling, chat template kwargs
- - **qiniu** (75% → 100%) - 24 tests, multi-provider model detection
- - **wenxin** (76% → 100%) - 10 tests, web search configuration
- - **giteeai** (73.33% → 100%) - 17 tests, models function with error handling
- - **v0** (73.33% → 100%) - 17 tests, models function with edge cases
- - **zeroone** (73.33% → 100%) - 20 tests, comprehensive models testing
- - **openai** (73.78% → 87.5%) - 10 tests, responses API, search models, flex tier
-
-- Added **198+ comprehensive tests** across core modules and providers
-
-- Fixed **16 TypeScript type errors** across test files
-
-- All enhanced files now have 95%+ or 100% coverage (except openai at 87.5% due to module-level env vars)
-
-- **Type check passed** - Zero type errors remaining
-
-- Used parallel subagent execution (6 concurrent agents) for maximum development speed
-
-**Previous Session (2025-10-13 - Part 3)**: 🎉 **Achieved 91.1% Overall Coverage - Target Exceeded!**
-
-- Overall coverage: 85.74% → **91.1% (+5.36%)**
-- **Target of 90% coverage achieved and exceeded!**
-- Completed all high-priority providers to 80%+ coverage
-- Refactored 13 providers with comprehensive test coverage:
- - **search1api** (52.08% → 100%) - 86 tests, complex payload and models logic
- - **openrouter** (52.83% → \~95%) - 69 tests, pricing and thinking features
- - **sensenova** (53.01% → 100%) - 104 tests, vision model message conversion
- - **zhipu** (55.83% → 100%) - 55 tests, tool_calls index fixing, thinking modes
- - **ollama** (56.03% → \~95%) - 56 tests, embeddings and pull model features
- - **ai360** (56.14% → 100%) - 79 tests, web search and reasoning models
- - **mistral** (57.14% → 100%) - 53 tests, temperature normalization
- - **cohere** (57.4% → 100%) - 70 tests, parameter constraints and features
- - **akashchat** (62.79% → 100%) - 35 tests, thinking parameter handling
- - **baichuan** (62.5% → 100%) - 26 tests, web search modes
- - **moonshot** (66.66% → 100%) - 33 tests, fixed temperature normalization bugs
- - **spark** (70.58% → 100%) - 31 tests, web search integration
- - **bedrock** (71.72% → 100%) - 42 tests, model-specific transformations
-- Added **584+ new comprehensive tests**
-- Fixed 8 bugs including:
- - Moonshot temperature normalization (6 failing tests)
- - Property naming issues (maxTokens → maxOutput in ai360, baichuan)
-- Fixed all 47 TypeScript type errors across 9 files
-- All providers now export `params` for better testability
-- Used parallel subagent execution for maximum development speed
-
-**Previous Session (2025-10-13 - Part 2)**: 🚀 5 High-Priority Providers Completed!
-
-- Overall coverage: 84.49% → 85.74% (+1.25%)
-- Refactored 5 high-priority providers:
- - **vercelaigateway** (50% → 100%) - 43 tests, fixed verbosity bug
- - **github** (52.08% → 97.95%) - 32 tests
- - **cometapi** (55.26% → 100%) - 28 tests
- - **cerebras** (55.55% → 100%) - 28 tests
- - **ollamacloud** (55.55% → 100%) - 24 tests
-- Added 155 comprehensive tests
-- Fixed 1 bug: verbosity parameter initialization in vercelaigateway
-- All providers now export `params` for better testability
-- Used parallel subagent execution for faster development
-
-**Previous Session (2025-10-13 - Part 1)**: 🎉 All Critical providers completed!
-
-- Overall coverage: 82.9% → 84.49% (+1.59%)
-- **Eliminated all critical (<50% coverage) providers!**
-- Refactored 5 providers:
- - **internlm** (39.13% → 100%) - 30 tests, fixed null model bug
- - **hunyuan** (39.68% → 100%) - 33 tests, fixed null model bug
- - **huggingface** (39.75% → 100%) - 38 tests
- - **groq** (45.45% → 100%) - 35 tests
- - **modelscope** (47.82% → 100%) - 24 tests
-- Added 160 comprehensive tests
-- Fixed 2 bugs: null/undefined model handling in internlm and hunyuan
-- All providers now export `params` for better testability
-- Used parallel subagent execution for faster development
-
-**Previous Session (2025-01-15)**:
-
-- Overall coverage: 81.86% → 82.9% (+1.04%)
-- Refactored 3 providers: **nebius** (32.3% → 100%), **stepfun** (34.92% → 100%), **lmstudio** (35.48% → 100%)
-- Added 93 new tests
-- All providers now export `params` for better testability
-
-**Earlier Session (2025-01-15)**:
-
-- Overall coverage: 80.81% → 81.86% (+1.05%)
-- Refactored 4 providers: **fireworksai**, **jina**, **tencentcloud**, **togetherai** (all now at 100%)
-- Added 65 new tests
-- Fixed bugs in togetherai provider
-
-## Notes
-
-### General Testing Notes
-
-- All providers should follow the same testing pattern for consistency
-- Exporting `params` makes testing much easier by allowing direct testing of configuration
-- `testProvider` utility provides basic test coverage for OpenAI-compatible providers
-- Custom feature tests should be added based on provider-specific functionality
-- Always mock API calls in tests (`skipAPICall: true`)
-- Debug environment variables should be tested
-- **Type check and lint must pass before committing**
-- **Update this document after each testing task completion**
-
-### Router Provider Specific Notes
-
-- **Router providers use `createRouterRuntime` instead of `createOpenAICompatibleRuntime`**
-- The `testProvider` utility does NOT work for router providers - write custom tests
-- Router providers route different models to different API implementations (anthropic, google, xai, openai)
-- Test both static and dynamic router configurations:
- - Static: `routers: [...]` - array of router configs
- - Dynamic: `routers: (options) => [...]` - function that generates routers based on user options
-- Router providers typically have complex `models` functions that:
- - Fetch models from a unified API endpoint
- - Process multi-provider model lists with `processMultiProviderModelList`
- - Handle provider detection from model metadata
- - May include custom pricing calculation logic
-- Test router-specific custom logic separately (e.g., `handlePayload`, pricing calculation)
-- Pay attention to baseURL processing - routers may need to:
- - Strip version paths (`/v1`, `/v1beta`) from baseURL
- - Apply different baseURL patterns for different API types
- - Handle user-provided custom baseURLs
-- Examples of router providers: `newapi`, `aihubmix`
-- For comprehensive router provider testing patterns, refer to `newapi/index.test.ts`
diff --git a/packages/model-runtime/src/core/ModelRuntime.test.ts b/packages/model-runtime/src/core/ModelRuntime.test.ts
index 75c49137185..04d5c5cf998 100644
--- a/packages/model-runtime/src/core/ModelRuntime.test.ts
+++ b/packages/model-runtime/src/core/ModelRuntime.test.ts
@@ -821,7 +821,7 @@ describe('ModelRuntime', () => {
it('onGenerateObjectComplete prefers errorType from ChatCompletionErrorPayload over name/code', async () => {
const onGenerateObjectComplete = vi.fn();
const { runtime, mockRuntimeAI } = createMockRuntime({ onGenerateObjectComplete });
- // Shape that openaiCompatibleFactory.handleError throws on real provider errors.
+ // Shape that openaiCompatible's handleError throws on real provider errors.
const cause = {
endpoint: 'https://api.example.com',
error: { status: 401 },
diff --git a/packages/model-runtime/src/core/RouterRuntime/createRuntime.jsonMode.test.ts b/packages/model-runtime/src/core/RouterRuntime/createRuntime.jsonMode.test.ts
index 4c8389f8ae4..498fd497a01 100644
--- a/packages/model-runtime/src/core/RouterRuntime/createRuntime.jsonMode.test.ts
+++ b/packages/model-runtime/src/core/RouterRuntime/createRuntime.jsonMode.test.ts
@@ -2,7 +2,7 @@
import type OpenAI from 'openai';
import { describe, expect, it, vi } from 'vitest';
-import { createOpenAICompatibleRuntime } from '../openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../openaiCompatible';
import { createRouterRuntime } from './createRuntime';
vi.mock('@lobechat/business-model-bank/model-config', () => ({
diff --git a/packages/model-runtime/src/core/RouterRuntime/routerOptions.ts b/packages/model-runtime/src/core/RouterRuntime/routerOptions.ts
index f09d4bdf5dc..c4d49c99a84 100644
--- a/packages/model-runtime/src/core/RouterRuntime/routerOptions.ts
+++ b/packages/model-runtime/src/core/RouterRuntime/routerOptions.ts
@@ -1,6 +1,6 @@
import type { ChatModelCard, RouterRuntimeRequestContext } from '@lobechat/types';
-import type { ClientOptions } from 'openai';
import type OpenAI from 'openai';
+import type { ClientOptions } from 'openai';
import type { Stream } from 'openai/streaming';
import type {
@@ -19,7 +19,7 @@ import type {
CreateImageOptions,
CreateVideoOptions,
CustomClientOptions,
-} from '../openaiCompatibleFactory';
+} from '../openaiCompatible';
import type { ApiType, RuntimeClass } from './apiTypes';
import type { RouteAttemptFinished, RouteAttemptResult } from './routeAttempt';
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/apiMode.ts b/packages/model-runtime/src/core/openaiCompatible/apiMode.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/apiMode.ts
rename to packages/model-runtime/src/core/openaiCompatible/apiMode.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/client.ts b/packages/model-runtime/src/core/openaiCompatible/client.ts
similarity index 99%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/client.ts
rename to packages/model-runtime/src/core/openaiCompatible/client.ts
index 2989a16f413..c89e0457a00 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/client.ts
+++ b/packages/model-runtime/src/core/openaiCompatible/client.ts
@@ -1,6 +1,7 @@
-import { isRecord } from '../../utils/object';
import OpenAI from 'openai';
+import { isRecord } from '../../utils/object';
+
/** Preserves flat JSON errors returned by OpenAI-compatible providers. */
export class OpenAICompatibleClient extends OpenAI {
protected override makeStatusError(
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/context.ts b/packages/model-runtime/src/core/openaiCompatible/context.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/context.ts
rename to packages/model-runtime/src/core/openaiCompatible/context.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts b/packages/model-runtime/src/core/openaiCompatible/createImage.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/createImage.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/createImage.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts b/packages/model-runtime/src/core/openaiCompatible/createImage.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/createImage.ts
rename to packages/model-runtime/src/core/openaiCompatible/createImage.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/createVideo.test.ts b/packages/model-runtime/src/core/openaiCompatible/createVideo.test.ts
similarity index 99%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/createVideo.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/createVideo.test.ts
index 05342cd231f..8be37fc9646 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/createVideo.test.ts
+++ b/packages/model-runtime/src/core/openaiCompatible/createVideo.test.ts
@@ -1,8 +1,8 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
import type { CreateVideoPayload } from '../../types/video';
+import type { CreateVideoOptions } from '.';
import {
createOpenAICompatibleVideo,
pollOpenAICompatibleVideoStatus,
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/createVideo.ts b/packages/model-runtime/src/core/openaiCompatible/createVideo.ts
similarity index 98%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/createVideo.ts
rename to packages/model-runtime/src/core/openaiCompatible/createVideo.ts
index d87451708f5..ef513d8a4da 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/createVideo.ts
+++ b/packages/model-runtime/src/core/openaiCompatible/createVideo.ts
@@ -7,7 +7,7 @@ import type {
PollVideoStatusResult,
} from '../../types/video';
import { resolveMappedModelId } from '../../utils/modelIdMapping';
-import type { CreateVideoOptions } from '../openaiCompatibleFactory';
+import type { CreateVideoOptions } from '.';
const log = createDebug('lobe-video:openai-compatible');
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/decide.openai.test.ts b/packages/model-runtime/src/core/openaiCompatible/decide.openai.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/decide.openai.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/decide.openai.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/decide.test.ts b/packages/model-runtime/src/core/openaiCompatible/decide.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/decide.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/decide.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/decide/index.ts b/packages/model-runtime/src/core/openaiCompatible/decide/index.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/decide/index.ts
rename to packages/model-runtime/src/core/openaiCompatible/decide/index.ts
index edd011f72bf..d3e3cdb65bc 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/decide/index.ts
+++ b/packages/model-runtime/src/core/openaiCompatible/decide/index.ts
@@ -1,6 +1,5 @@
import type { ModelUsage } from '@lobechat/types';
import { AgentRuntimeErrorType } from '@lobechat/types';
-import { isRecord } from '../../../utils/object';
import createDebug from 'debug';
import { DECISION_MODEL_SUFFIX } from 'model-bank';
import type OpenAI from 'openai';
@@ -15,6 +14,7 @@ import { AgentRuntimeError } from '../../../utils/createError';
import { getModelPricing } from '../../../utils/getModelPricing';
import type { ModelIdMappingOptions } from '../../../utils/modelIdMapping';
import { resolveMappedModelId } from '../../../utils/modelIdMapping';
+import { isRecord } from '../../../utils/object';
import { withUsageCost } from '../../usageConverters/utils/withUsageCost';
import { openaiDecisionAdapter } from './openai';
import type { DecisionWireAdapter } from './shared';
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/decide/openai.ts b/packages/model-runtime/src/core/openaiCompatible/decide/openai.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/decide/openai.ts
rename to packages/model-runtime/src/core/openaiCompatible/decide/openai.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/decide/shared.ts b/packages/model-runtime/src/core/openaiCompatible/decide/shared.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/decide/shared.ts
rename to packages/model-runtime/src/core/openaiCompatible/decide/shared.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/decide/systemOne.ts b/packages/model-runtime/src/core/openaiCompatible/decide/systemOne.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/decide/systemOne.ts
rename to packages/model-runtime/src/core/openaiCompatible/decide/systemOne.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/errorResponse.test.ts b/packages/model-runtime/src/core/openaiCompatible/errorResponse.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/errorResponse.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/errorResponse.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/errors.ts b/packages/model-runtime/src/core/openaiCompatible/errors.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/errors.ts
rename to packages/model-runtime/src/core/openaiCompatible/errors.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/factoryOptions.ts b/packages/model-runtime/src/core/openaiCompatible/factoryOptions.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/factoryOptions.ts
rename to packages/model-runtime/src/core/openaiCompatible/factoryOptions.ts
index 9812658b042..7970c2d2fe1 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/factoryOptions.ts
+++ b/packages/model-runtime/src/core/openaiCompatible/factoryOptions.ts
@@ -1,7 +1,7 @@
import type { ChatModelCard } from '@lobechat/types';
import type { AiFullModelCard } from 'model-bank';
-import type { ClientOptions } from 'openai';
import type OpenAI from 'openai';
+import type { ClientOptions } from 'openai';
import type { Stream } from 'openai/streaming';
import type {
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/generateObject.messages.test.ts b/packages/model-runtime/src/core/openaiCompatible/generateObject.messages.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/generateObject.messages.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/generateObject.messages.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/generateObject.test.ts b/packages/model-runtime/src/core/openaiCompatible/generateObject.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/generateObject.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/generateObject.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/generateObject.ts b/packages/model-runtime/src/core/openaiCompatible/generateObject.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/generateObject.ts
rename to packages/model-runtime/src/core/openaiCompatible/generateObject.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/imageOutputParams.test.ts b/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/imageOutputParams.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/imageOutputParams.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/imageOutputParams.ts b/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/imageOutputParams.ts
rename to packages/model-runtime/src/core/openaiCompatible/imageOutputParams.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/index.responsesInputs.test.ts b/packages/model-runtime/src/core/openaiCompatible/index.responsesInputs.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/index.responsesInputs.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/index.responsesInputs.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts b/packages/model-runtime/src/core/openaiCompatible/index.test.ts
similarity index 99%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/index.test.ts
index 9f4a72e9090..487af54fcf9 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts
+++ b/packages/model-runtime/src/core/openaiCompatible/index.test.ts
@@ -5,7 +5,6 @@ import type { Stream } from 'openai/streaming';
import type { Mock } from 'vitest';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
import type { ChatStreamCallbacks, ChatStreamPayload } from '../../types/chat';
import { AgentRuntimeErrorType } from '../../types/error';
import type { ModelRuntimeDiagnostics } from '../../types/providerDiagnostics';
@@ -16,6 +15,7 @@ import {
serializeScopedSignature,
} from '../../utils/signatureScope';
import { createVideoWithCompletionMode } from '../../utils/videoCompletionMode';
+import type { LobeOpenAICompatibleRuntime } from '../BaseAI';
import * as openaiHelpers from '../contextBuilders/openai';
import { createOpenAICompatibleRuntime } from './index';
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/index.ts b/packages/model-runtime/src/core/openaiCompatible/index.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/index.ts
rename to packages/model-runtime/src/core/openaiCompatible/index.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/jsonResponseMode.test.ts b/packages/model-runtime/src/core/openaiCompatible/jsonResponseMode.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/jsonResponseMode.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/jsonResponseMode.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/models.ts b/packages/model-runtime/src/core/openaiCompatible/models.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/models.ts
rename to packages/model-runtime/src/core/openaiCompatible/models.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/providerDiagnostics.test.ts b/packages/model-runtime/src/core/openaiCompatible/providerDiagnostics.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/providerDiagnostics.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/providerDiagnostics.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/providerDiagnostics.ts b/packages/model-runtime/src/core/openaiCompatible/providerDiagnostics.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/providerDiagnostics.ts
rename to packages/model-runtime/src/core/openaiCompatible/providerDiagnostics.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/responseTools.test.ts b/packages/model-runtime/src/core/openaiCompatible/responseTools.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/responseTools.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/responseTools.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/structuredOutput.test.ts b/packages/model-runtime/src/core/openaiCompatible/structuredOutput.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/structuredOutput.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/structuredOutput.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/structuredOutput.ts b/packages/model-runtime/src/core/openaiCompatible/structuredOutput.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/structuredOutput.ts
rename to packages/model-runtime/src/core/openaiCompatible/structuredOutput.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/textToSpeech.test.ts b/packages/model-runtime/src/core/openaiCompatible/textToSpeech.test.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/textToSpeech.test.ts
rename to packages/model-runtime/src/core/openaiCompatible/textToSpeech.test.ts
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/textToSpeech.ts b/packages/model-runtime/src/core/openaiCompatible/textToSpeech.ts
similarity index 100%
rename from packages/model-runtime/src/core/openaiCompatibleFactory/textToSpeech.ts
rename to packages/model-runtime/src/core/openaiCompatible/textToSpeech.ts
diff --git a/packages/model-runtime/src/core/protocols/openaiChatCompletions/chat.ts b/packages/model-runtime/src/core/protocols/openaiChatCompletions/chat.ts
index b71656f93dc..c1611f49799 100644
--- a/packages/model-runtime/src/core/protocols/openaiChatCompletions/chat.ts
+++ b/packages/model-runtime/src/core/protocols/openaiChatCompletions/chat.ts
@@ -8,15 +8,15 @@ import { debugPayload, debugResponse, debugStream } from '../../../utils/debugSt
import { desensitizeUrl } from '../../../utils/desensitizeUrl';
import { getModelPricing } from '../../../utils/getModelPricing';
import { StreamingResponse } from '../../../utils/response';
-import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatibleFactory/context';
-import type { OpenAICompatibleFactoryOptions } from '../../openaiCompatibleFactory/factoryOptions';
+import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatible/context';
+import type { OpenAICompatibleFactoryOptions } from '../../openaiCompatible/factoryOptions';
import {
initializeOpenAIDiagnostics,
observeOpenAIChatCompletionStream,
recordOpenAIChatCompletionResponse,
recordOpenAIResponseMetadata,
resolveOpenAIResponseWithMetadata,
-} from '../../openaiCompatibleFactory/providerDiagnostics';
+} from '../../openaiCompatible/providerDiagnostics';
import { resolveModelSamplingParameters } from '../../parameterResolver';
import { readableFromAsyncIterable } from '../../streams/protocol';
import { convertOpenAIMessages } from './messages';
diff --git a/packages/model-runtime/src/core/protocols/openaiChatCompletions/generateObject.ts b/packages/model-runtime/src/core/protocols/openaiChatCompletions/generateObject.ts
index 0648fa4ace3..5eb411999ea 100644
--- a/packages/model-runtime/src/core/protocols/openaiChatCompletions/generateObject.ts
+++ b/packages/model-runtime/src/core/protocols/openaiChatCompletions/generateObject.ts
@@ -7,16 +7,16 @@ import type {
GenerateObjectPayload,
GenerateObjectSchema,
} from '../../../types';
-import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatibleFactory/context';
+import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatible/context';
import type {
ChatCompletionCreateParamsWithPromptCacheKey,
OpenAICompatibleFactoryOptions,
-} from '../../openaiCompatibleFactory/factoryOptions';
+} from '../../openaiCompatible/factoryOptions';
import {
parseStructuredOutputText,
parseStructuredToolArguments,
StructuredOutputError,
-} from '../../openaiCompatibleFactory/structuredOutput';
+} from '../../openaiCompatible/structuredOutput';
import type { ChatPayloadForTransformStream } from '../../streams/protocol';
import { convertOpenAIUsage } from '../../usageConverters/openai';
import { convertOpenAIMessages } from './messages';
diff --git a/packages/model-runtime/src/core/protocols/openaiResponses/chat.ts b/packages/model-runtime/src/core/protocols/openaiResponses/chat.ts
index bdbe6a8e287..7495e4590ca 100644
--- a/packages/model-runtime/src/core/protocols/openaiResponses/chat.ts
+++ b/packages/model-runtime/src/core/protocols/openaiResponses/chat.ts
@@ -7,19 +7,19 @@ import { debugPayload, debugResponse, debugStream } from '../../../utils/debugSt
import { desensitizeUrl } from '../../../utils/desensitizeUrl';
import { getModelPricing } from '../../../utils/getModelPricing';
import { StreamingResponse } from '../../../utils/response';
-import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatibleFactory/context';
+import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatible/context';
import type {
OpenAICompatibleFactoryOptions,
OpenAIExtraParams,
ResponseCreateParamsWithPromptCacheKey,
-} from '../../openaiCompatibleFactory/factoryOptions';
+} from '../../openaiCompatible/factoryOptions';
import {
initializeOpenAIDiagnostics,
observeOpenAIResponsesStream,
recordOpenAIResponseMetadata,
recordOpenAIResponsesResponse,
resolveOpenAIResponseWithMetadata,
-} from '../../openaiCompatibleFactory/providerDiagnostics';
+} from '../../openaiCompatible/providerDiagnostics';
import { resolveModelSamplingParameters } from '../../parameterResolver';
import { readableFromAsyncIterable } from '../../streams/protocol';
import type { OpenAIStreamOptions } from '../openaiChatCompletions/stream';
diff --git a/packages/model-runtime/src/core/protocols/openaiResponses/generateObject.ts b/packages/model-runtime/src/core/protocols/openaiResponses/generateObject.ts
index 749350857b3..bee05e0e40e 100644
--- a/packages/model-runtime/src/core/protocols/openaiResponses/generateObject.ts
+++ b/packages/model-runtime/src/core/protocols/openaiResponses/generateObject.ts
@@ -10,13 +10,13 @@ import type {
GenerateObjectPayload,
GenerateObjectSchema,
} from '../../../types';
-import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatibleFactory/context';
-import type { OpenAICompatibleFactoryOptions } from '../../openaiCompatibleFactory/factoryOptions';
+import type { OpenAICompatibleRuntimeContext } from '../../openaiCompatible/context';
+import type { OpenAICompatibleFactoryOptions } from '../../openaiCompatible/factoryOptions';
import {
parseStructuredOutputText,
parseStructuredToolArguments,
StructuredOutputError,
-} from '../../openaiCompatibleFactory/structuredOutput';
+} from '../../openaiCompatible/structuredOutput';
import type { ChatPayloadForTransformStream } from '../../streams/protocol';
import { convertOpenAIResponseUsage } from '../../usageConverters/openai';
import { convertOpenAIResponseInputs } from './inputs';
diff --git a/packages/model-runtime/src/index.ts b/packages/model-runtime/src/index.ts
index 5cfa5fa0248..4fe7a53b127 100644
--- a/packages/model-runtime/src/index.ts
+++ b/packages/model-runtime/src/index.ts
@@ -7,8 +7,8 @@ export { pruneReasoningPayload } from './core/contextBuilders/openai';
export { mergeModelRuntimeHooks } from './core/mergeHooks';
export type { ModelRuntimeHooks } from './core/ModelRuntime';
export { describeGenerateObjectError, ModelRuntime } from './core/ModelRuntime';
-export { createOpenAICompatibleRuntime } from './core/openaiCompatibleFactory';
-export { StructuredOutputError } from './core/openaiCompatibleFactory/structuredOutput';
+export { createOpenAICompatibleRuntime } from './core/openaiCompatible';
+export { StructuredOutputError } from './core/openaiCompatible/structuredOutput';
export * from './core/RouterRuntime';
export { createCallbacksTransformer } from './core/streams/protocol';
export * from './core/usageConverters';
diff --git a/packages/model-runtime/src/providerTestUtils.test.ts b/packages/model-runtime/src/providerTestUtils.test.ts
index 884821673fb..ab66d1c7f32 100644
--- a/packages/model-runtime/src/providerTestUtils.test.ts
+++ b/packages/model-runtime/src/providerTestUtils.test.ts
@@ -2,7 +2,7 @@
import type { ILobeAgentRuntimeErrorType } from '@lobechat/types';
import { describe } from 'vitest';
-import { createOpenAICompatibleRuntime } from './core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from './core/openaiCompatible';
import { testProvider } from './providerTestUtils';
// Provider plumbing compares error codes as strings; this suite intentionally
diff --git a/packages/model-runtime/src/providers/ai21/index.ts b/packages/model-runtime/src/providers/ai21/index.ts
index e0d54f97d8a..ab44b503132 100644
--- a/packages/model-runtime/src/providers/ai21/index.ts
+++ b/packages/model-runtime/src/providers/ai21/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export const LobeAi21AI = createOpenAICompatibleRuntime({
baseURL: 'https://api.ai21.com/studio/v1',
diff --git a/packages/model-runtime/src/providers/ai302/index.ts b/packages/model-runtime/src/providers/ai302/index.ts
index b46dd9bbb98..be30b6f4b1e 100644
--- a/packages/model-runtime/src/providers/ai302/index.ts
+++ b/packages/model-runtime/src/providers/ai302/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatCompletionErrorPayload } from '../../types';
import { AgentRuntimeErrorType } from '../../types/error';
import { processMultiProviderModelList } from '../../utils/modelParse';
diff --git a/packages/model-runtime/src/providers/ai360/index.ts b/packages/model-runtime/src/providers/ai360/index.ts
index 3426cd51a73..5aefe0fb0b8 100644
--- a/packages/model-runtime/src/providers/ai360/index.ts
+++ b/packages/model-runtime/src/providers/ai360/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface Ai360ModelCard {
id: string;
diff --git a/packages/model-runtime/src/providers/akashchat/index.ts b/packages/model-runtime/src/providers/akashchat/index.ts
index 42c8c1f0384..2598bd2c620 100644
--- a/packages/model-runtime/src/providers/akashchat/index.ts
+++ b/packages/model-runtime/src/providers/akashchat/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
const THINKING_MODELS = new Set(['DeepSeek-V3-1']);
diff --git a/packages/model-runtime/src/providers/antgroup/index.ts b/packages/model-runtime/src/providers/antgroup/index.ts
index 079af504e67..4b1d6dc6734 100644
--- a/packages/model-runtime/src/providers/antgroup/index.ts
+++ b/packages/model-runtime/src/providers/antgroup/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export const LobeAntGroupAI = createOpenAICompatibleRuntime({
baseURL: 'https://api.ant-ling.com/v1',
diff --git a/packages/model-runtime/src/providers/azureOpenai/index.ts b/packages/model-runtime/src/providers/azureOpenai/index.ts
index af0ddf2386a..a2b90a53cfb 100644
--- a/packages/model-runtime/src/providers/azureOpenai/index.ts
+++ b/packages/model-runtime/src/providers/azureOpenai/index.ts
@@ -4,11 +4,11 @@ import type OpenAI from 'openai';
import { AzureOpenAI } from 'openai';
import { pruneReasoningPayload } from '../../core/contextBuilders/openai';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import {
applyImageOutputParams,
resolveImageOutputMimeType,
-} from '../../core/openaiCompatibleFactory/imageOutputParams';
+} from '../../core/openaiCompatible/imageOutputParams';
import { refineErrorCode } from '../../errors';
import type {
ASROptions,
diff --git a/packages/model-runtime/src/providers/azureai/index.ts b/packages/model-runtime/src/providers/azureai/index.ts
index b4c663da8e3..0175b94951d 100644
--- a/packages/model-runtime/src/providers/azureai/index.ts
+++ b/packages/model-runtime/src/providers/azureai/index.ts
@@ -7,7 +7,7 @@ import { ModelProvider } from 'model-bank';
import type OpenAI from 'openai';
import type { LobeRuntimeAI } from '../../core/BaseAI';
-import { transformResponseToStream } from '../../core/openaiCompatibleFactory';
+import { transformResponseToStream } from '../../core/openaiCompatible';
import { OpenAIStream } from '../../core/protocols/openaiChatCompletions/stream';
import {
appendProviderResponseEvent,
diff --git a/packages/model-runtime/src/providers/baichuan/index.ts b/packages/model-runtime/src/providers/baichuan/index.ts
index 1b488fffba3..d8e676db179 100644
--- a/packages/model-runtime/src/providers/baichuan/index.ts
+++ b/packages/model-runtime/src/providers/baichuan/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import type { ChatStreamPayload } from '../../types';
diff --git a/packages/model-runtime/src/providers/bailianCodingPlan/index.ts b/packages/model-runtime/src/providers/bailianCodingPlan/index.ts
index d318dc5a7eb..26466decf93 100644
--- a/packages/model-runtime/src/providers/bailianCodingPlan/index.ts
+++ b/packages/model-runtime/src/providers/bailianCodingPlan/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import { QwenAIStream } from '../../core/streams';
import { processMultiProviderModelList } from '../../utils/modelParse';
diff --git a/packages/model-runtime/src/providers/cerebras/index.ts b/packages/model-runtime/src/providers/cerebras/index.ts
index 34a748bab36..547b7fd5f29 100644
--- a/packages/model-runtime/src/providers/cerebras/index.ts
+++ b/packages/model-runtime/src/providers/cerebras/index.ts
@@ -1,10 +1,10 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
import {
createOpenAICompatibleRuntime,
transformResponseToStream,
-} from '../../core/openaiCompatibleFactory';
+} from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export const params = {
diff --git a/packages/model-runtime/src/providers/chatGPT/index.ts b/packages/model-runtime/src/providers/chatGPT/index.ts
index ce281d458f7..6fc0bfcff3b 100644
--- a/packages/model-runtime/src/providers/chatGPT/index.ts
+++ b/packages/model-runtime/src/providers/chatGPT/index.ts
@@ -2,7 +2,7 @@ import { CURRENT_VERSION } from '@lobechat/const';
import { ModelProvider } from 'model-bank';
import OpenAI from 'openai';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { params as openAIParams } from '../openai';
const CHATGPT_CODEX_BASE_URL = 'https://chatgpt.com/backend-api/codex';
diff --git a/packages/model-runtime/src/providers/cohere/index.ts b/packages/model-runtime/src/providers/cohere/index.ts
index d0979fff48a..bc95a7f1da8 100644
--- a/packages/model-runtime/src/providers/cohere/index.ts
+++ b/packages/model-runtime/src/providers/cohere/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
export interface CohereModelCard {
diff --git a/packages/model-runtime/src/providers/cometapi/index.ts b/packages/model-runtime/src/providers/cometapi/index.ts
index 6a9e84af641..70fe64ff59c 100644
--- a/packages/model-runtime/src/providers/cometapi/index.ts
+++ b/packages/model-runtime/src/providers/cometapi/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export interface CometAPIModelCard {
diff --git a/packages/model-runtime/src/providers/deepseek/generateObject.ts b/packages/model-runtime/src/providers/deepseek/generateObject.ts
index 39458853ff2..17f9bd8027b 100644
--- a/packages/model-runtime/src/providers/deepseek/generateObject.ts
+++ b/packages/model-runtime/src/providers/deepseek/generateObject.ts
@@ -3,7 +3,7 @@ import type { Pricing } from 'model-bank';
import type { AnthropicGenerateObjectConfig } from '../../core/anthropicCompatibleFactory/generateObject';
import { createAnthropicGenerateObject } from '../../core/anthropicCompatibleFactory/generateObject';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
import type { ChatStreamPayload, GenerateObjectOptions, GenerateObjectPayload } from '../../types';
import { isDeepSeekV4Model } from './chatPayload';
import { sanitizeDeepSeekJsonPayload } from './sanitizePayload';
diff --git a/packages/model-runtime/src/providers/deepseek/index.ts b/packages/model-runtime/src/providers/deepseek/index.ts
index 7078f461ec4..76e8ea0d256 100644
--- a/packages/model-runtime/src/providers/deepseek/index.ts
+++ b/packages/model-runtime/src/providers/deepseek/index.ts
@@ -4,8 +4,8 @@ import {
createAnthropicCompatibleParams,
createAnthropicCompatibleRuntime,
} from '../../core/anthropicCompatibleFactory';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { CreateRouterRuntimeOptions } from '../../core/RouterRuntime';
import { createRouterRuntime } from '../../core/RouterRuntime';
import { buildDeepSeekAnthropicPayload, buildDeepSeekOpenAIPayload } from './chatPayload';
diff --git a/packages/model-runtime/src/providers/fireworksai/index.ts b/packages/model-runtime/src/providers/fireworksai/index.ts
index 62d9ed66b33..0111d969a0f 100644
--- a/packages/model-runtime/src/providers/fireworksai/index.ts
+++ b/packages/model-runtime/src/providers/fireworksai/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface FireworksAIModelCard {
context_length: number;
diff --git a/packages/model-runtime/src/providers/giteeai/index.ts b/packages/model-runtime/src/providers/giteeai/index.ts
index 95921132309..814cb1f77c3 100644
--- a/packages/model-runtime/src/providers/giteeai/index.ts
+++ b/packages/model-runtime/src/providers/giteeai/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export interface GiteeAIModelCard {
diff --git a/packages/model-runtime/src/providers/github/index.ts b/packages/model-runtime/src/providers/github/index.ts
index 6d9b423a14e..29c62edfdb0 100644
--- a/packages/model-runtime/src/providers/github/index.ts
+++ b/packages/model-runtime/src/providers/github/index.ts
@@ -1,8 +1,8 @@
import { ModelProvider } from 'model-bank';
import { pruneReasoningPayload } from '../../core/contextBuilders/openai';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { AgentRuntimeErrorType } from '../../types/error';
import { processMultiProviderModelList } from '../../utils/modelParse';
@@ -25,7 +25,6 @@ export interface GithubModelCard {
version: string;
}
-
export const params = {
baseURL: 'https://models.github.ai/inference',
chatCompletion: {
diff --git a/packages/model-runtime/src/providers/githubCopilot/index.ts b/packages/model-runtime/src/providers/githubCopilot/index.ts
index 6d19dc00b0c..cd0e3c60d6a 100644
--- a/packages/model-runtime/src/providers/githubCopilot/index.ts
+++ b/packages/model-runtime/src/providers/githubCopilot/index.ts
@@ -6,7 +6,7 @@ import OpenAI from 'openai';
import { buildDefaultAnthropicPayload } from '../../core/anthropicCompatibleFactory';
import { type LobeRuntimeAI } from '../../core/BaseAI';
import { pruneReasoningPayload } from '../../core/contextBuilders/openai';
-import { transformResponseAPIToStream } from '../../core/openaiCompatibleFactory';
+import { transformResponseAPIToStream } from '../../core/openaiCompatible';
import { convertOpenAIMessages } from '../../core/protocols/openaiChatCompletions/messages';
import { OpenAIStream } from '../../core/protocols/openaiChatCompletions/stream';
import { convertOpenAIResponseInputs } from '../../core/protocols/openaiResponses/inputs';
diff --git a/packages/model-runtime/src/providers/glmCodingPlan/index.ts b/packages/model-runtime/src/providers/glmCodingPlan/index.ts
index 55919160b6b..b2013ab9656 100644
--- a/packages/model-runtime/src/providers/glmCodingPlan/index.ts
+++ b/packages/model-runtime/src/providers/glmCodingPlan/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export const LobeGLMCodingPlanAI = createOpenAICompatibleRuntime({
diff --git a/packages/model-runtime/src/providers/groq/index.ts b/packages/model-runtime/src/providers/groq/index.ts
index 367da82fcd7..1dd8b28bf0a 100644
--- a/packages/model-runtime/src/providers/groq/index.ts
+++ b/packages/model-runtime/src/providers/groq/index.ts
@@ -1,11 +1,11 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
import {
createOpenAICompatibleRuntime,
transformResponseToStream,
-} from '../../core/openaiCompatibleFactory';
+} from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import { AgentRuntimeErrorType } from '../../types/error';
diff --git a/packages/model-runtime/src/providers/higress/index.ts b/packages/model-runtime/src/providers/higress/index.ts
index 0f324559108..f9e9d84f258 100644
--- a/packages/model-runtime/src/providers/higress/index.ts
+++ b/packages/model-runtime/src/providers/higress/index.ts
@@ -2,8 +2,8 @@ import type { ChatModelCard } from '@lobechat/types';
import { uniqueId } from 'es-toolkit/compat';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface HigressModelCard {
context_length: number;
diff --git a/packages/model-runtime/src/providers/huggingface/index.ts b/packages/model-runtime/src/providers/huggingface/index.ts
index 00d69f6ebd4..f0e7d63d872 100644
--- a/packages/model-runtime/src/providers/huggingface/index.ts
+++ b/packages/model-runtime/src/providers/huggingface/index.ts
@@ -3,8 +3,8 @@ import { ModelProvider } from 'model-bank';
import urlJoin from 'url-join';
import { convertOpenAIMessagesToHFFormat } from '../../core/contextBuilders/huggingface';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { convertIterableToStream } from '../../core/streams';
import { AgentRuntimeErrorType } from '../../types/error';
import { processMultiProviderModelList } from '../../utils/modelParse';
@@ -109,8 +109,7 @@ export const params = {
: model.id;
const pricing = getFieldFromProviders('pricing') as
- | { input?: number; output?: number }
- | undefined;
+ { input?: number; output?: number } | undefined;
return {
contextWindowTokens,
diff --git a/packages/model-runtime/src/providers/hunyuan/createImage.test.ts b/packages/model-runtime/src/providers/hunyuan/createImage.test.ts
index b3faafb79b5..1fd109b058b 100644
--- a/packages/model-runtime/src/providers/hunyuan/createImage.test.ts
+++ b/packages/model-runtime/src/providers/hunyuan/createImage.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload } from '../../types/image';
import { createHunyuanImage } from './createImage';
diff --git a/packages/model-runtime/src/providers/hunyuan/createImage.ts b/packages/model-runtime/src/providers/hunyuan/createImage.ts
index d9550b1c7dc..bd2a9d87a28 100644
--- a/packages/model-runtime/src/providers/hunyuan/createImage.ts
+++ b/packages/model-runtime/src/providers/hunyuan/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import { asyncifyPolling } from '../../utils/asyncifyPolling';
import { AgentRuntimeError } from '../../utils/createError';
diff --git a/packages/model-runtime/src/providers/hunyuan/createVideo.test.ts b/packages/model-runtime/src/providers/hunyuan/createVideo.test.ts
index fe0607a420d..7362b5ceab9 100644
--- a/packages/model-runtime/src/providers/hunyuan/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/hunyuan/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import { createHunyuanVideo, pollHunyuanVideoStatus, queryHunyuanVideoStatus } from './createVideo';
diff --git a/packages/model-runtime/src/providers/hunyuan/createVideo.ts b/packages/model-runtime/src/providers/hunyuan/createVideo.ts
index f68f0a0d640..5d4c76d3c3f 100644
--- a/packages/model-runtime/src/providers/hunyuan/createVideo.ts
+++ b/packages/model-runtime/src/providers/hunyuan/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type {
CreateVideoPayload,
CreateVideoResult,
diff --git a/packages/model-runtime/src/providers/hunyuan/index.ts b/packages/model-runtime/src/providers/hunyuan/index.ts
index b26579602a3..3070f4c1693 100644
--- a/packages/model-runtime/src/providers/hunyuan/index.ts
+++ b/packages/model-runtime/src/providers/hunyuan/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { createHunyuanImage } from './createImage';
import { createHunyuanVideo } from './createVideo';
diff --git a/packages/model-runtime/src/providers/infiniai/index.ts b/packages/model-runtime/src/providers/infiniai/index.ts
index ef5b47df3ad..09921c31d68 100644
--- a/packages/model-runtime/src/providers/infiniai/index.ts
+++ b/packages/model-runtime/src/providers/infiniai/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export interface InfiniAIModelCard {
diff --git a/packages/model-runtime/src/providers/internlm/index.ts b/packages/model-runtime/src/providers/internlm/index.ts
index f4c5490db05..2fab0d9834b 100644
--- a/packages/model-runtime/src/providers/internlm/index.ts
+++ b/packages/model-runtime/src/providers/internlm/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
export interface InternLMModelCard {
diff --git a/packages/model-runtime/src/providers/jina/index.ts b/packages/model-runtime/src/providers/jina/index.ts
index 8c7f8a2f489..9ef07bd8950 100644
--- a/packages/model-runtime/src/providers/jina/index.ts
+++ b/packages/model-runtime/src/providers/jina/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface JinaModelCard {
id: string;
diff --git a/packages/model-runtime/src/providers/lmstudio/index.ts b/packages/model-runtime/src/providers/lmstudio/index.ts
index ad07d37ad2b..c5cd1ce7392 100644
--- a/packages/model-runtime/src/providers/lmstudio/index.ts
+++ b/packages/model-runtime/src/providers/lmstudio/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface LMStudioModelCard {
id: string;
diff --git a/packages/model-runtime/src/providers/longcat/index.ts b/packages/model-runtime/src/providers/longcat/index.ts
index 3754c3258d1..5aa41e495d4 100644
--- a/packages/model-runtime/src/providers/longcat/index.ts
+++ b/packages/model-runtime/src/providers/longcat/index.ts
@@ -1,6 +1,6 @@
import { longcat as longcatChatModels, ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import { getModelMaxOutputs } from '../../utils/getModelMaxOutputs';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
diff --git a/packages/model-runtime/src/providers/magpie/index.ts b/packages/model-runtime/src/providers/magpie/index.ts
index ba7427a3ec5..0a6dccc2c1e 100644
--- a/packages/model-runtime/src/providers/magpie/index.ts
+++ b/packages/model-runtime/src/providers/magpie/index.ts
@@ -3,8 +3,8 @@ import type { ChatModelCard } from '@lobechat/types';
import { loadModels, MODEL_REASONING_EXTEND_PARAMS, ModelProvider } from 'model-bank';
import OpenAI from 'openai';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
type ModelSettings = NonNullable<ChatModelCard['settings']>;
diff --git a/packages/model-runtime/src/providers/meta/index.ts b/packages/model-runtime/src/providers/meta/index.ts
index da97ee4b624..426bc62af4b 100644
--- a/packages/model-runtime/src/providers/meta/index.ts
+++ b/packages/model-runtime/src/providers/meta/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatResponseFormat, ChatStreamPayload } from '../../types';
/**
diff --git a/packages/model-runtime/src/providers/minimax/createImage.test.ts b/packages/model-runtime/src/providers/minimax/createImage.test.ts
index b01ccb822ae..b89dea39062 100644
--- a/packages/model-runtime/src/providers/minimax/createImage.test.ts
+++ b/packages/model-runtime/src/providers/minimax/createImage.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload } from '../../types/image';
import { createMiniMaxImage } from './createImage';
diff --git a/packages/model-runtime/src/providers/minimax/createImage.ts b/packages/model-runtime/src/providers/minimax/createImage.ts
index 354ba7ca71b..1d6c45ec915 100644
--- a/packages/model-runtime/src/providers/minimax/createImage.ts
+++ b/packages/model-runtime/src/providers/minimax/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import { AgentRuntimeError } from '../../utils/createError';
import { resolveMappedModelId } from '../../utils/modelIdMapping';
diff --git a/packages/model-runtime/src/providers/minimax/createVideo.test.ts b/packages/model-runtime/src/providers/minimax/createVideo.test.ts
index ca352e3d166..62722d0f9da 100644
--- a/packages/model-runtime/src/providers/minimax/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/minimax/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import {
createMiniMaxVideo,
diff --git a/packages/model-runtime/src/providers/minimax/createVideo.ts b/packages/model-runtime/src/providers/minimax/createVideo.ts
index 3f4005a2e22..5327adcfd78 100644
--- a/packages/model-runtime/src/providers/minimax/createVideo.ts
+++ b/packages/model-runtime/src/providers/minimax/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import { getVideoReferenceImages } from '../../core/usageConverters/utils/computeVideoCost';
import type { CreateVideoPayload, CreateVideoResult } from '../../types/video';
import { resolveMappedModelId } from '../../utils/modelIdMapping';
diff --git a/packages/model-runtime/src/providers/minimax/index.ts b/packages/model-runtime/src/providers/minimax/index.ts
index ad74420fe22..885ce03481f 100644
--- a/packages/model-runtime/src/providers/minimax/index.ts
+++ b/packages/model-runtime/src/providers/minimax/index.ts
@@ -6,8 +6,8 @@ import {
createAnthropicCompatibleParams,
createAnthropicCompatibleRuntime,
} from '../../core/anthropicCompatibleFactory';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import type { CreateRouterRuntimeOptions } from '../../core/RouterRuntime';
import { createRouterRuntime } from '../../core/RouterRuntime';
diff --git a/packages/model-runtime/src/providers/minimaxCodingPlan/index.ts b/packages/model-runtime/src/providers/minimaxCodingPlan/index.ts
index 4eb90bfb419..64baf7a9f68 100644
--- a/packages/model-runtime/src/providers/minimaxCodingPlan/index.ts
+++ b/packages/model-runtime/src/providers/minimaxCodingPlan/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export const LobeMinimaxCodingPlanAI = createOpenAICompatibleRuntime({
diff --git a/packages/model-runtime/src/providers/mistral/index.ts b/packages/model-runtime/src/providers/mistral/index.ts
index 16ef6326bbe..7f5bfd39157 100644
--- a/packages/model-runtime/src/providers/mistral/index.ts
+++ b/packages/model-runtime/src/providers/mistral/index.ts
@@ -2,8 +2,8 @@ import type { ChatModelCard } from '@lobechat/types';
import type { AiModelSettings } from 'model-bank';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
export interface MistralModelCard {
diff --git a/packages/model-runtime/src/providers/modelscope/index.ts b/packages/model-runtime/src/providers/modelscope/index.ts
index 281258fe463..b817bed035e 100644
--- a/packages/model-runtime/src/providers/modelscope/index.ts
+++ b/packages/model-runtime/src/providers/modelscope/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export interface ModelScopeModelCard {
diff --git a/packages/model-runtime/src/providers/moonshot/index.ts b/packages/model-runtime/src/providers/moonshot/index.ts
index 401930fc797..2cdff344cf8 100644
--- a/packages/model-runtime/src/providers/moonshot/index.ts
+++ b/packages/model-runtime/src/providers/moonshot/index.ts
@@ -11,7 +11,7 @@ import {
} from '../../core/anthropicCompatibleFactory';
import type { AnthropicGenerateObjectConfig } from '../../core/anthropicCompatibleFactory/generateObject';
import { createAnthropicGenerateObject } from '../../core/anthropicCompatibleFactory/generateObject';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { CreateRouterRuntimeOptions } from '../../core/RouterRuntime';
import { createRouterRuntime } from '../../core/RouterRuntime';
import type { ChatStreamPayload, GenerateObjectOptions, GenerateObjectPayload } from '../../types';
@@ -534,9 +534,7 @@ const createAnthropicRouter = ({
} = {}) => ({
apiType: 'anthropic' as const,
...(baseURLPattern ? { baseURLPattern } : {}),
- options: {
- ...(baseURL ? { baseURL } : {}),
- },
+ options: baseURL ? { baseURL } : {},
runtime: LobeMoonshotAnthropicAI,
});
diff --git a/packages/model-runtime/src/providers/nebius/index.ts b/packages/model-runtime/src/providers/nebius/index.ts
index 55c80e0a054..7fa4a255781 100644
--- a/packages/model-runtime/src/providers/nebius/index.ts
+++ b/packages/model-runtime/src/providers/nebius/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export interface NebiusModelCard {
diff --git a/packages/model-runtime/src/providers/novita/index.ts b/packages/model-runtime/src/providers/novita/index.ts
index ce799154188..6890f43dafe 100644
--- a/packages/model-runtime/src/providers/novita/index.ts
+++ b/packages/model-runtime/src/providers/novita/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
import type { NovitaModelCard } from './type';
diff --git a/packages/model-runtime/src/providers/nvidia/index.ts b/packages/model-runtime/src/providers/nvidia/index.ts
index cfafc5fce65..91929cc56df 100644
--- a/packages/model-runtime/src/providers/nvidia/index.ts
+++ b/packages/model-runtime/src/providers/nvidia/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider, nvidia as nvidiaChatModels } from 'model-bank';
-import { type OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { type OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
// Models that support preserved thinking (enable_thinking + clear_thinking parameters)
diff --git a/packages/model-runtime/src/providers/ollama/generateObject.test.ts b/packages/model-runtime/src/providers/ollama/generateObject.test.ts
index e202388de29..b94c1e8204a 100644
--- a/packages/model-runtime/src/providers/ollama/generateObject.test.ts
+++ b/packages/model-runtime/src/providers/ollama/generateObject.test.ts
@@ -2,7 +2,7 @@
import { Ollama } from 'ollama/browser';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { StructuredOutputError } from '../../core/openaiCompatibleFactory/structuredOutput';
+import { StructuredOutputError } from '../../core/openaiCompatible/structuredOutput';
import { AgentRuntimeErrorType } from '../../types/error';
import { LobeOllamaAI } from './index';
diff --git a/packages/model-runtime/src/providers/ollama/index.ts b/packages/model-runtime/src/providers/ollama/index.ts
index 0e1c76f0ab4..4dc4a73d927 100644
--- a/packages/model-runtime/src/providers/ollama/index.ts
+++ b/packages/model-runtime/src/providers/ollama/index.ts
@@ -1,5 +1,4 @@
import type { ChatModelCard } from '@lobechat/types';
-import { imageUrlToBase64 } from '../../utils/imageToBase64';
import { ModelProvider } from 'model-bank';
import type { ChatResponse, Tool } from 'ollama/browser';
import { Ollama } from 'ollama/browser';
@@ -10,7 +9,7 @@ import {
parseStructuredOutputText,
parseStructuredToolArguments,
StructuredOutputError,
-} from '../../core/openaiCompatibleFactory/structuredOutput';
+} from '../../core/openaiCompatible/structuredOutput';
import { convertIterableToStream, createModelPullStream, OllamaStream } from '../../core/streams';
import type {
ChatMethodOptions,
@@ -27,6 +26,7 @@ import { AgentRuntimeErrorType } from '../../types/error';
import { AgentRuntimeError } from '../../utils/createError';
import { debugStream } from '../../utils/debugStream';
import { createErrorResponse } from '../../utils/errorResponse';
+import { imageUrlToBase64 } from '../../utils/imageToBase64';
import { StreamingResponse } from '../../utils/response';
import { parseDataUri } from '../../utils/uriParser';
import type { OllamaMessage } from './type';
diff --git a/packages/model-runtime/src/providers/ollamacloud/index.ts b/packages/model-runtime/src/providers/ollamacloud/index.ts
index 9ca63053627..96c64f16581 100644
--- a/packages/model-runtime/src/providers/ollamacloud/index.ts
+++ b/packages/model-runtime/src/providers/ollamacloud/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export const params = {
diff --git a/packages/model-runtime/src/providers/openai/index.ts b/packages/model-runtime/src/providers/openai/index.ts
index c749a16e7a9..0b33e5313c9 100644
--- a/packages/model-runtime/src/providers/openai/index.ts
+++ b/packages/model-runtime/src/providers/openai/index.ts
@@ -1,8 +1,8 @@
import { ModelProvider, openaiChatModels } from 'model-bank';
import { pruneReasoningPayload } from '../../core/contextBuilders/openai';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatStreamPayload } from '../../types';
import { processMultiProviderModelList } from '../../utils/modelParse';
import { appendDecisionModels } from '../../utils/postProcessModelList';
diff --git a/packages/model-runtime/src/providers/opencodeCodingPlan/index.ts b/packages/model-runtime/src/providers/opencodeCodingPlan/index.ts
index 939dc943648..22e88331105 100644
--- a/packages/model-runtime/src/providers/opencodeCodingPlan/index.ts
+++ b/packages/model-runtime/src/providers/opencodeCodingPlan/index.ts
@@ -1,8 +1,7 @@
-import { pickNonEmptyString } from '../../utils/object';
import { LOBE_DEFAULT_MODEL_LIST, ModelProvider } from 'model-bank';
import type OpenAI from 'openai';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { createRouterRuntime } from '../../core/RouterRuntime';
import type { CreateRouterRuntimeOptions } from '../../core/RouterRuntime/createRuntime';
import type {
@@ -12,6 +11,7 @@ import type {
GenerateObjectPayload,
} from '../../types';
import { processMultiProviderModelList } from '../../utils/modelParse';
+import { pickNonEmptyString } from '../../utils/object';
import {
isKimiNativeThinkingModel,
isKimiReasoningEffortModel,
diff --git a/packages/model-runtime/src/providers/openrouter/index.ts b/packages/model-runtime/src/providers/openrouter/index.ts
index 3d971885e4a..8bb167ee383 100644
--- a/packages/model-runtime/src/providers/openrouter/index.ts
+++ b/packages/model-runtime/src/providers/openrouter/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
import type { OpenRouterModelCard, OpenRouterReasoning } from './type';
diff --git a/packages/model-runtime/src/providers/perplexity/index.ts b/packages/model-runtime/src/providers/perplexity/index.ts
index f077c63e3d5..604d567a21f 100644
--- a/packages/model-runtime/src/providers/perplexity/index.ts
+++ b/packages/model-runtime/src/providers/perplexity/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
import type OpenAI from 'openai';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import type { ChatStreamPayload } from '../../types';
diff --git a/packages/model-runtime/src/providers/ppio/index.ts b/packages/model-runtime/src/providers/ppio/index.ts
index c835fdafdb4..cbe253e9297 100644
--- a/packages/model-runtime/src/providers/ppio/index.ts
+++ b/packages/model-runtime/src/providers/ppio/index.ts
@@ -1,7 +1,7 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { PPIOModelCard } from './type';
export const LobePPIOAI = createOpenAICompatibleRuntime({
diff --git a/packages/model-runtime/src/providers/qiniu/index.ts b/packages/model-runtime/src/providers/qiniu/index.ts
index bbd6bb25354..bc2b1a03977 100644
--- a/packages/model-runtime/src/providers/qiniu/index.ts
+++ b/packages/model-runtime/src/providers/qiniu/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export const params = {
diff --git a/packages/model-runtime/src/providers/qwen/createImage.test.ts b/packages/model-runtime/src/providers/qwen/createImage.test.ts
index 25c9e50fe58..2796ab98d6c 100644
--- a/packages/model-runtime/src/providers/qwen/createImage.test.ts
+++ b/packages/model-runtime/src/providers/qwen/createImage.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { type CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import { type CreateImageOptions } from '../../core/openaiCompatible';
import { type CreateImagePayload } from '../../types/image';
import { createQwenImage } from './createImage';
diff --git a/packages/model-runtime/src/providers/qwen/createImage.ts b/packages/model-runtime/src/providers/qwen/createImage.ts
index b6a95cd77dc..c7d44b62ad2 100644
--- a/packages/model-runtime/src/providers/qwen/createImage.ts
+++ b/packages/model-runtime/src/providers/qwen/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import type { TaskResult } from '../../utils/asyncifyPolling';
import { asyncifyPolling } from '../../utils/asyncifyPolling';
diff --git a/packages/model-runtime/src/providers/qwen/createVideo.test.ts b/packages/model-runtime/src/providers/qwen/createVideo.test.ts
index b17d62cc9a2..69d3f1eee53 100644
--- a/packages/model-runtime/src/providers/qwen/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/qwen/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import { createQwenVideo, pollQwenVideoStatus, queryQwenVideoStatus } from './createVideo';
diff --git a/packages/model-runtime/src/providers/qwen/createVideo.ts b/packages/model-runtime/src/providers/qwen/createVideo.ts
index 069f0c538cf..eba84cf82c9 100644
--- a/packages/model-runtime/src/providers/qwen/createVideo.ts
+++ b/packages/model-runtime/src/providers/qwen/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload, CreateVideoResult } from '../../types/video';
import { AgentRuntimeError } from '../../utils/createError';
diff --git a/packages/model-runtime/src/providers/qwen/index.ts b/packages/model-runtime/src/providers/qwen/index.ts
index a438ed11a3f..338b367191d 100644
--- a/packages/model-runtime/src/providers/qwen/index.ts
+++ b/packages/model-runtime/src/providers/qwen/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import { QwenAIStream } from '../../core/streams';
import { processMultiProviderModelList } from '../../utils/modelParse';
diff --git a/packages/model-runtime/src/providers/sambanova/index.ts b/packages/model-runtime/src/providers/sambanova/index.ts
index 1457a6dec9e..96730472293 100644
--- a/packages/model-runtime/src/providers/sambanova/index.ts
+++ b/packages/model-runtime/src/providers/sambanova/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export const LobeSambaNovaAI = createOpenAICompatibleRuntime({
baseURL: 'https://api.sambanova.ai/v1',
diff --git a/packages/model-runtime/src/providers/search1api/index.ts b/packages/model-runtime/src/providers/search1api/index.ts
index df12f9b82d1..79a843d6f4b 100644
--- a/packages/model-runtime/src/providers/search1api/index.ts
+++ b/packages/model-runtime/src/providers/search1api/index.ts
@@ -2,8 +2,8 @@ import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
import type OpenAI from 'openai';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatStreamPayload } from '../../types';
export interface Search1APIModelCard {
diff --git a/packages/model-runtime/src/providers/sensenova/index.ts b/packages/model-runtime/src/providers/sensenova/index.ts
index fd6440fd590..a7d3ef766a2 100644
--- a/packages/model-runtime/src/providers/sensenova/index.ts
+++ b/packages/model-runtime/src/providers/sensenova/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { LOBE_DEFAULT_MODEL_LIST, ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface SenseNovaModelCard {
context_length: number;
diff --git a/packages/model-runtime/src/providers/siliconcloud/createImage.ts b/packages/model-runtime/src/providers/siliconcloud/createImage.ts
index fc212998f06..d93b7a3cf0e 100644
--- a/packages/model-runtime/src/providers/siliconcloud/createImage.ts
+++ b/packages/model-runtime/src/providers/siliconcloud/createImage.ts
@@ -1,7 +1,7 @@
import createDebug from 'debug';
import type { RuntimeImageGenParamsValue } from 'model-bank';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types';
import { AgentRuntimeErrorType } from '../../types/error';
import { AgentRuntimeError } from '../../utils/createError';
diff --git a/packages/model-runtime/src/providers/siliconcloud/createVideo.test.ts b/packages/model-runtime/src/providers/siliconcloud/createVideo.test.ts
index 6a410cc60bc..08ff30b4676 100644
--- a/packages/model-runtime/src/providers/siliconcloud/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/siliconcloud/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import {
createSiliconCloudVideo,
diff --git a/packages/model-runtime/src/providers/siliconcloud/createVideo.ts b/packages/model-runtime/src/providers/siliconcloud/createVideo.ts
index 88f2ab48b68..cb2a33457fa 100644
--- a/packages/model-runtime/src/providers/siliconcloud/createVideo.ts
+++ b/packages/model-runtime/src/providers/siliconcloud/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload, CreateVideoResult } from '../../types/video';
const log = createDebug('lobe-video:siliconcloud');
diff --git a/packages/model-runtime/src/providers/siliconcloud/index.ts b/packages/model-runtime/src/providers/siliconcloud/index.ts
index 34d79524923..a2da90947ea 100644
--- a/packages/model-runtime/src/providers/siliconcloud/index.ts
+++ b/packages/model-runtime/src/providers/siliconcloud/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatCompletionErrorPayload } from '../../types';
import { AgentRuntimeErrorType } from '../../types/error';
import { processMultiProviderModelList } from '../../utils/modelParse';
diff --git a/packages/model-runtime/src/providers/spark/index.ts b/packages/model-runtime/src/providers/spark/index.ts
index 59a7d10931e..c4118390d8b 100644
--- a/packages/model-runtime/src/providers/spark/index.ts
+++ b/packages/model-runtime/src/providers/spark/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { SparkAIStream, transformSparkResponseToStream } from '../../core/streams';
import type { ChatStreamPayload } from '../../types';
diff --git a/packages/model-runtime/src/providers/stepfun/createImage.ts b/packages/model-runtime/src/providers/stepfun/createImage.ts
index d909a4b7121..4d754f11d8d 100644
--- a/packages/model-runtime/src/providers/stepfun/createImage.ts
+++ b/packages/model-runtime/src/providers/stepfun/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import { AgentRuntimeError } from '../../utils/createError';
diff --git a/packages/model-runtime/src/providers/stepfun/index.ts b/packages/model-runtime/src/providers/stepfun/index.ts
index aac918251c8..0688a317ef5 100644
--- a/packages/model-runtime/src/providers/stepfun/index.ts
+++ b/packages/model-runtime/src/providers/stepfun/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { createStepfunImage } from './createImage';
export interface StepfunModelCard {
diff --git a/packages/model-runtime/src/providers/straico/index.ts b/packages/model-runtime/src/providers/straico/index.ts
index 953927694cb..44ffc4a0ca7 100644
--- a/packages/model-runtime/src/providers/straico/index.ts
+++ b/packages/model-runtime/src/providers/straico/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
import type { StraicoChatModel, StraicoModelsResponse } from './type';
diff --git a/packages/model-runtime/src/providers/streamlake/index.ts b/packages/model-runtime/src/providers/streamlake/index.ts
index 8451fce5d7d..944390e4cfb 100644
--- a/packages/model-runtime/src/providers/streamlake/index.ts
+++ b/packages/model-runtime/src/providers/streamlake/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export const LobeStreamLakeAI = createOpenAICompatibleRuntime({
baseURL: 'https://wanqing.streamlakeapi.com/api/gateway/v1/endpoints',
diff --git a/packages/model-runtime/src/providers/superGrok/index.ts b/packages/model-runtime/src/providers/superGrok/index.ts
index 4cc15297492..53cf0438cc2 100644
--- a/packages/model-runtime/src/providers/superGrok/index.ts
+++ b/packages/model-runtime/src/providers/superGrok/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
import {
handleXAIChatCompletionPayload,
diff --git a/packages/model-runtime/src/providers/taichu/index.ts b/packages/model-runtime/src/providers/taichu/index.ts
index f99924b4a5b..ab8cd2b7b63 100644
--- a/packages/model-runtime/src/providers/taichu/index.ts
+++ b/packages/model-runtime/src/providers/taichu/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
import type OpenAI from 'openai';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatStreamPayload } from '../../types';
export const LobeTaichuAI = createOpenAICompatibleRuntime({
diff --git a/packages/model-runtime/src/providers/tencentcloud/index.ts b/packages/model-runtime/src/providers/tencentcloud/index.ts
index 8ccb4d3d582..55da83d64b9 100644
--- a/packages/model-runtime/src/providers/tencentcloud/index.ts
+++ b/packages/model-runtime/src/providers/tencentcloud/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface TencentCloudModelCard {
id: string;
diff --git a/packages/model-runtime/src/providers/togetherai/index.ts b/packages/model-runtime/src/providers/togetherai/index.ts
index efea9560abc..9996c04b630 100644
--- a/packages/model-runtime/src/providers/togetherai/index.ts
+++ b/packages/model-runtime/src/providers/togetherai/index.ts
@@ -1,8 +1,8 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { TogetherAIModel } from './type';
export const params = {
diff --git a/packages/model-runtime/src/providers/typesafe/index.ts b/packages/model-runtime/src/providers/typesafe/index.ts
index 8d3b072ef29..9f7498eed34 100644
--- a/packages/model-runtime/src/providers/typesafe/index.ts
+++ b/packages/model-runtime/src/providers/typesafe/index.ts
@@ -1,6 +1,6 @@
import type { LobeRuntimeAI } from '../../core/BaseAI';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export const params = {
baseURL: 'https://api.typesafe.ai/v1',
diff --git a/packages/model-runtime/src/providers/unsloth/index.ts b/packages/model-runtime/src/providers/unsloth/index.ts
index a29d6608ea2..686dcfceedd 100644
--- a/packages/model-runtime/src/providers/unsloth/index.ts
+++ b/packages/model-runtime/src/providers/unsloth/index.ts
@@ -3,8 +3,8 @@ import debug from 'debug';
import { ModelProvider } from 'model-bank';
import { APIConnectionTimeoutError, APIError } from 'openai';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
const log = debug('lobe-model-runtime:unsloth');
diff --git a/packages/model-runtime/src/providers/upstage/index.ts b/packages/model-runtime/src/providers/upstage/index.ts
index d89fab00be3..a8dfdc145ba 100644
--- a/packages/model-runtime/src/providers/upstage/index.ts
+++ b/packages/model-runtime/src/providers/upstage/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export const LobeUpstageAI = createOpenAICompatibleRuntime({
baseURL: 'https://api.upstage.ai/v1/solar',
diff --git a/packages/model-runtime/src/providers/v0/index.ts b/packages/model-runtime/src/providers/v0/index.ts
index ae7919ec7be..e97fc554cd8 100644
--- a/packages/model-runtime/src/providers/v0/index.ts
+++ b/packages/model-runtime/src/providers/v0/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
export interface V0ModelCard {
diff --git a/packages/model-runtime/src/providers/vercelaigateway/index.ts b/packages/model-runtime/src/providers/vercelaigateway/index.ts
index fd47deb5544..7d1a17ee088 100644
--- a/packages/model-runtime/src/providers/vercelaigateway/index.ts
+++ b/packages/model-runtime/src/providers/vercelaigateway/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export interface VercelAIGatewayModelCard {
diff --git a/packages/model-runtime/src/providers/vllm/index.ts b/packages/model-runtime/src/providers/vllm/index.ts
index 96bcf5fecfe..ace4d9caaaf 100644
--- a/packages/model-runtime/src/providers/vllm/index.ts
+++ b/packages/model-runtime/src/providers/vllm/index.ts
@@ -1,7 +1,7 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface VLLMModelCard {
id: string;
diff --git a/packages/model-runtime/src/providers/volcengine/createImage.test.ts b/packages/model-runtime/src/providers/volcengine/createImage.test.ts
index 88c266e8080..820a532ad74 100644
--- a/packages/model-runtime/src/providers/volcengine/createImage.test.ts
+++ b/packages/model-runtime/src/providers/volcengine/createImage.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload } from '../../types/image';
import { createVolcengineImage } from './createImage';
diff --git a/packages/model-runtime/src/providers/volcengine/createImage.ts b/packages/model-runtime/src/providers/volcengine/createImage.ts
index 992441319ec..a83295fa19d 100644
--- a/packages/model-runtime/src/providers/volcengine/createImage.ts
+++ b/packages/model-runtime/src/providers/volcengine/createImage.ts
@@ -2,7 +2,7 @@ import createDebug from 'debug';
import type { RuntimeImageGenParamsValue } from 'model-bank';
import OpenAI from 'openai';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
const log = createDebug('lobe-image:volcengine');
diff --git a/packages/model-runtime/src/providers/volcengine/index.ts b/packages/model-runtime/src/providers/volcengine/index.ts
index 0b07e9a9522..a20db3b416a 100644
--- a/packages/model-runtime/src/providers/volcengine/index.ts
+++ b/packages/model-runtime/src/providers/volcengine/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatStreamPayload } from '../../types';
import { createVolcengineImage } from './createImage';
import { createVolcengineVideo } from './video/createVideo';
diff --git a/packages/model-runtime/src/providers/volcengine/video/createVideo.test.ts b/packages/model-runtime/src/providers/volcengine/video/createVideo.test.ts
index ad15e729aa7..edc4a70f935 100644
--- a/packages/model-runtime/src/providers/volcengine/video/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/volcengine/video/createVideo.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../../types/video';
import { createVolcengineVideo } from './createVideo';
diff --git a/packages/model-runtime/src/providers/volcengine/video/createVideo.ts b/packages/model-runtime/src/providers/volcengine/video/createVideo.ts
index 1404f02e484..f1f93857c49 100644
--- a/packages/model-runtime/src/providers/volcengine/video/createVideo.ts
+++ b/packages/model-runtime/src/providers/volcengine/video/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../../core/openaiCompatible';
import type { CreateVideoPayload, CreateVideoResult } from '../../../types/video';
const log = createDebug('lobe-video:volcengine');
diff --git a/packages/model-runtime/src/providers/volcengineCodingPlan/index.ts b/packages/model-runtime/src/providers/volcengineCodingPlan/index.ts
index f07cb075827..68afef0a186 100644
--- a/packages/model-runtime/src/providers/volcengineCodingPlan/index.ts
+++ b/packages/model-runtime/src/providers/volcengineCodingPlan/index.ts
@@ -1,6 +1,6 @@
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
export const LobeVolcengineCodingPlanAI = createOpenAICompatibleRuntime({
diff --git a/packages/model-runtime/src/providers/wenxin/createImage.test.ts b/packages/model-runtime/src/providers/wenxin/createImage.test.ts
index b0316069476..f18b307da95 100644
--- a/packages/model-runtime/src/providers/wenxin/createImage.test.ts
+++ b/packages/model-runtime/src/providers/wenxin/createImage.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload } from '../../types/image';
import { createWenxinImage } from './createImage';
diff --git a/packages/model-runtime/src/providers/wenxin/createImage.ts b/packages/model-runtime/src/providers/wenxin/createImage.ts
index 9647f72e6c5..29751e0319a 100644
--- a/packages/model-runtime/src/providers/wenxin/createImage.ts
+++ b/packages/model-runtime/src/providers/wenxin/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import { AgentRuntimeError } from '../../utils/createError';
diff --git a/packages/model-runtime/src/providers/wenxin/createVideo.test.ts b/packages/model-runtime/src/providers/wenxin/createVideo.test.ts
index 6ae3fba4570..66abd9ef0ea 100644
--- a/packages/model-runtime/src/providers/wenxin/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/wenxin/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import { createWenxinVideo, pollWenxinVideoStatus, queryWenxinVideoStatus } from './createVideo';
diff --git a/packages/model-runtime/src/providers/wenxin/createVideo.ts b/packages/model-runtime/src/providers/wenxin/createVideo.ts
index 00b57333e91..708c0c69af3 100644
--- a/packages/model-runtime/src/providers/wenxin/createVideo.ts
+++ b/packages/model-runtime/src/providers/wenxin/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload, CreateVideoResult } from '../../types/video';
const log = createDebug('lobe-video:wenxin');
diff --git a/packages/model-runtime/src/providers/wenxin/index.ts b/packages/model-runtime/src/providers/wenxin/index.ts
index 64c7fb28a3b..203902555eb 100644
--- a/packages/model-runtime/src/providers/wenxin/index.ts
+++ b/packages/model-runtime/src/providers/wenxin/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { processMultiProviderModelList } from '../../utils/modelParse';
import { createWenxinImage } from './createImage';
import { createWenxinVideo } from './createVideo';
diff --git a/packages/model-runtime/src/providers/xai/createImage.test.ts b/packages/model-runtime/src/providers/xai/createImage.test.ts
index c5e3ffb3873..8b2a909b5b6 100644
--- a/packages/model-runtime/src/providers/xai/createImage.test.ts
+++ b/packages/model-runtime/src/providers/xai/createImage.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload } from '../../types/image';
import { createXAIImage } from './createImage';
diff --git a/packages/model-runtime/src/providers/xai/createImage.ts b/packages/model-runtime/src/providers/xai/createImage.ts
index b24c3f2a77c..1897b0328dd 100644
--- a/packages/model-runtime/src/providers/xai/createImage.ts
+++ b/packages/model-runtime/src/providers/xai/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import { AgentRuntimeError } from '../../utils/createError';
diff --git a/packages/model-runtime/src/providers/xai/createVideo.test.ts b/packages/model-runtime/src/providers/xai/createVideo.test.ts
index 7bcb5811cef..b50fcd88f13 100644
--- a/packages/model-runtime/src/providers/xai/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/xai/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import { createXAIVideo, pollXAIVideoStatus, queryXAIVideoStatus } from './createVideo';
diff --git a/packages/model-runtime/src/providers/xai/createVideo.ts b/packages/model-runtime/src/providers/xai/createVideo.ts
index f0c64042f51..996ee6c446c 100644
--- a/packages/model-runtime/src/providers/xai/createVideo.ts
+++ b/packages/model-runtime/src/providers/xai/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload, CreateVideoResult } from '../../types/video';
const log = createDebug('lobe-video:xai');
diff --git a/packages/model-runtime/src/providers/xai/index.ts b/packages/model-runtime/src/providers/xai/index.ts
index 3ce1fdd612c..1bf08c435d6 100644
--- a/packages/model-runtime/src/providers/xai/index.ts
+++ b/packages/model-runtime/src/providers/xai/index.ts
@@ -1,9 +1,9 @@
-import { isRecord } from '../../utils/object';
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import type { ChatCompletionTool, ChatResponseFormat, ChatStreamPayload } from '../../types';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
+import { isRecord } from '../../utils/object';
import { createXAIImage } from './createImage';
import { createXAIVideo } from './createVideo';
diff --git a/packages/model-runtime/src/providers/xiaomimimo/index.ts b/packages/model-runtime/src/providers/xiaomimimo/index.ts
index 04c579e81ad..0d7c72c7d05 100644
--- a/packages/model-runtime/src/providers/xiaomimimo/index.ts
+++ b/packages/model-runtime/src/providers/xiaomimimo/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider, xiaomimimo as xiaomimimoChatModels } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { getModelMaxOutputs } from '../../utils/getModelMaxOutputs';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
diff --git a/packages/model-runtime/src/providers/xinference/index.ts b/packages/model-runtime/src/providers/xinference/index.ts
index 072481ba76d..9c4d84a7d70 100644
--- a/packages/model-runtime/src/providers/xinference/index.ts
+++ b/packages/model-runtime/src/providers/xinference/index.ts
@@ -1,7 +1,7 @@
import type { ChatModelCard } from '@lobechat/types';
import { ModelProvider } from 'model-bank';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
export interface XinferenceModelCard {
context_length: number;
diff --git a/packages/model-runtime/src/providers/zeroone/index.ts b/packages/model-runtime/src/providers/zeroone/index.ts
index 0cafa1bf103..8b6b40e4884 100644
--- a/packages/model-runtime/src/providers/zeroone/index.ts
+++ b/packages/model-runtime/src/providers/zeroone/index.ts
@@ -1,7 +1,7 @@
import { ModelProvider } from 'model-bank';
-import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatibleFactory';
-import { createOpenAICompatibleRuntime } from '../../core/openaiCompatibleFactory';
+import type { OpenAICompatibleFactoryOptions } from '../../core/openaiCompatible';
+import { createOpenAICompatibleRuntime } from '../../core/openaiCompatible';
import { MODEL_LIST_CONFIGS, processModelList } from '../../utils/modelParse';
export interface ZeroOneModelCard {
diff --git a/packages/model-runtime/src/providers/zhipu/createImage.test.ts b/packages/model-runtime/src/providers/zhipu/createImage.test.ts
index be4e33cb7bd..ed7d87acad9 100644
--- a/packages/model-runtime/src/providers/zhipu/createImage.test.ts
+++ b/packages/model-runtime/src/providers/zhipu/createImage.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload } from '../../types/image';
import { createZhipuImage, pollZhipuImageStatus, queryZhipuImageStatus } from './createImage';
diff --git a/packages/model-runtime/src/providers/zhipu/createImage.ts b/packages/model-runtime/src/providers/zhipu/createImage.ts
index 66686da6466..06eece1e2f9 100644
--- a/packages/model-runtime/src/providers/zhipu/createImage.ts
+++ b/packages/model-runtime/src/providers/zhipu/createImage.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateImageOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateImageOptions } from '../../core/openaiCompatible';
import type { CreateImagePayload, CreateImageResponse } from '../../types/image';
import type { TaskResult } from '../../utils/asyncifyPolling';
import { asyncifyPolling } from '../../utils/asyncifyPolling';
diff --git a/packages/model-runtime/src/providers/zhipu/createVideo.test.ts b/packages/model-runtime/src/providers/zhipu/createVideo.test.ts
index 2c8bd67ba5d..f09565deee2 100644
--- a/packages/model-runtime/src/providers/zhipu/createVideo.test.ts
+++ b/packages/model-runtime/src/providers/zhipu/createVideo.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type { CreateVideoPayload } from '../../types/video';
import { createZhipuVideo, pollZhipuVideoStatus, queryZhipuVideoStatus } from './createVideo';
diff --git a/packages/model-runtime/src/providers/zhipu/createVideo.ts b/packages/model-runtime/src/providers/zhipu/createVideo.ts
index 5f86544986c..ac039615c8f 100644
--- a/packages/model-runtime/src/providers/zhipu/createVideo.ts
+++ b/packages/model-runtime/src/providers/zhipu/createVideo.ts
@@ -1,6 +1,6 @@
import createDebug from 'debug';
-import type { CreateVideoOptions } from '../../core/openaiCompatibleFactory';
+import type { CreateVideoOptions } from '../../core/openaiCompatible';
import type {
CreateVideoPayload,
CreateVideoResult,
diff --git a/packages/model-runtime/src/providers/zhipu/index.ts b/packages/model-runtime/src/providers/zhipu/index.ts
index cef6ff40633..eb4e07d435d 100644
--- a/packages/model-runtime/src/providers/zhipu/index.ts
+++ b/packages/model-runtime/src/providers/zhipu/index.ts
@@ -3,7 +3,7 @@ import { ModelProvider, zhipu as zhipuChatModels } from 'model-bank';
import {
createOpenAICompatibleRuntime,
type OpenAICompatibleFactoryOptions,
-} from '../../core/openaiCompatibleFactory';
+} from '../../core/openaiCompatible';
import { resolveParameters } from '../../core/parameterResolver';
import { OpenAIStream } from '../../core/protocols/openaiChatCompletions/stream';
import { convertIterableToStream } from '../../core/streams/protocol';
diff --git a/packages/model-runtime/src/utils/resolveSafeMaxTokens.ts b/packages/model-runtime/src/utils/resolveSafeMaxTokens.ts
index 8eb89ced140..ee302be1e71 100644
--- a/packages/model-runtime/src/utils/resolveSafeMaxTokens.ts
+++ b/packages/model-runtime/src/utils/resolveSafeMaxTokens.ts
@@ -32,7 +32,7 @@ export interface ResolveSafeMaxTokensOptions {
/**
* Thrown when the estimated prompt tokens leave less room than
* `minOutputTokens` for completion (or already exceed the model's context
- * window). Caught by `openaiCompatibleFactory` and surfaced as an
+ * window). Caught by `openaiCompatible` and surfaced as an
* `ExceededContextWindow` chat error carrying structured diagnostic fields
* — see for the rationale of failing fast instead of issuing a
* doomed upstream request.