feat: add sonnet and haiku to supported providers (#1317)
This commit is contained in:
@@ -12,7 +12,10 @@
|
||||
|
||||
import { createClaudeCode } from 'ai-sdk-provider-claude-code';
|
||||
import { BaseAIProvider } from './base-provider.js';
|
||||
import { getClaudeCodeSettingsForCommand } from '../../scripts/modules/config-manager.js';
|
||||
import {
|
||||
getClaudeCodeSettingsForCommand,
|
||||
getSupportedModelsForProvider
|
||||
} from '../../scripts/modules/config-manager.js';
|
||||
import { execSync } from 'child_process';
|
||||
import { log } from '../../scripts/modules/utils.js';
|
||||
|
||||
@@ -24,14 +27,24 @@ let _claudeCliAvailable = null;
|
||||
*
|
||||
* Features:
|
||||
* - No API key required (uses local Claude Code CLI)
|
||||
* - Supports 'sonnet' and 'opus' models
|
||||
* - Supported models loaded from supported-models.json
|
||||
* - Command-specific configuration support
|
||||
*/
|
||||
export class ClaudeCodeProvider extends BaseAIProvider {
|
||||
constructor() {
|
||||
super();
|
||||
this.name = 'Claude Code';
|
||||
this.supportedModels = ['sonnet', 'opus'];
|
||||
// Load supported models from supported-models.json
|
||||
this.supportedModels = getSupportedModelsForProvider('claude-code');
|
||||
|
||||
// Validate that models were loaded successfully
|
||||
if (this.supportedModels.length === 0) {
|
||||
log(
|
||||
'warn',
|
||||
'No supported models found for claude-code provider. Check supported-models.json configuration.'
|
||||
);
|
||||
}
|
||||
|
||||
// Claude Code requires explicit JSON schema mode
|
||||
this.needsExplicitJsonSchema = true;
|
||||
// Claude Code does not support temperature parameter
|
||||
|
||||
@@ -10,7 +10,10 @@ import { createCodexCli } from 'ai-sdk-provider-codex-cli';
|
||||
import { BaseAIProvider } from './base-provider.js';
|
||||
import { execSync } from 'child_process';
|
||||
import { log } from '../../scripts/modules/utils.js';
|
||||
import { getCodexCliSettingsForCommand } from '../../scripts/modules/config-manager.js';
|
||||
import {
|
||||
getCodexCliSettingsForCommand,
|
||||
getSupportedModelsForProvider
|
||||
} from '../../scripts/modules/config-manager.js';
|
||||
|
||||
export class CodexCliProvider extends BaseAIProvider {
|
||||
constructor() {
|
||||
@@ -20,8 +23,17 @@ export class CodexCliProvider extends BaseAIProvider {
|
||||
this.needsExplicitJsonSchema = false;
|
||||
// Codex CLI does not support temperature parameter
|
||||
this.supportsTemperature = false;
|
||||
// Restrict to supported models for OAuth subscription usage
|
||||
this.supportedModels = ['gpt-5', 'gpt-5-codex'];
|
||||
// Load supported models from supported-models.json
|
||||
this.supportedModels = getSupportedModelsForProvider('codex-cli');
|
||||
|
||||
// Validate that models were loaded successfully
|
||||
if (this.supportedModels.length === 0) {
|
||||
log(
|
||||
'warn',
|
||||
'No supported models found for codex-cli provider. Check supported-models.json configuration.'
|
||||
);
|
||||
}
|
||||
|
||||
// CLI availability check cache
|
||||
this._codexCliChecked = false;
|
||||
this._codexCliAvailable = null;
|
||||
|
||||
Reference in New Issue
Block a user