Compare commits

...

4 Commits

Author SHA1 Message Date
Ralph Khreish
95d4ba9b28 chore: fix logging error in mcp stdio 2025-10-18 16:29:30 +02:00
github-actions[bot]
b8830d9508 docs: Auto-update and format models.md 2025-10-18 09:13:05 +00:00
Ralph Khreish
548beb4344 feat: add sonnet and haiku to supported providers (#1317) 2025-10-18 11:12:48 +02:00
Ralph Khreish
555da2b5b9 fix: downgrade log level to silent (#1321) 2025-10-18 11:03:27 +02:00
12 changed files with 108 additions and 15 deletions

View File

@@ -0,0 +1,5 @@
---
"task-master-ai": minor
---
Add 4.5 haiku and sonnet to supported models for claude-code and anthropic ai providers

View File

@@ -1,4 +1,4 @@
# Available Models as of October 5, 2025
# Available Models as of October 18, 2025
## Main Models
@@ -8,8 +8,11 @@
| anthropic | claude-opus-4-20250514 | 0.725 | 15 | 75 |
| anthropic | claude-3-7-sonnet-20250219 | 0.623 | 3 | 15 |
| anthropic | claude-3-5-sonnet-20241022 | 0.49 | 3 | 15 |
| anthropic | claude-sonnet-4-5-20250929 | 0.73 | 3 | 15 |
| anthropic | claude-haiku-4-5-20251001 | 0.45 | 1 | 5 |
| claude-code | opus | 0.725 | 0 | 0 |
| claude-code | sonnet | 0.727 | 0 | 0 |
| claude-code | haiku | 0.45 | 0 | 0 |
| codex-cli | gpt-5 | 0.749 | 0 | 0 |
| codex-cli | gpt-5-codex | 0.749 | 0 | 0 |
| mcp | mcp-sampling | — | 0 | 0 |
@@ -102,6 +105,7 @@
| ----------- | -------------------------------------------- | --------- | ---------- | ----------- |
| claude-code | opus | 0.725 | 0 | 0 |
| claude-code | sonnet | 0.727 | 0 | 0 |
| claude-code | haiku | 0.45 | 0 | 0 |
| codex-cli | gpt-5 | 0.749 | 0 | 0 |
| codex-cli | gpt-5-codex | 0.749 | 0 | 0 |
| mcp | mcp-sampling | — | 0 | 0 |
@@ -142,8 +146,11 @@
| anthropic | claude-opus-4-20250514 | 0.725 | 15 | 75 |
| anthropic | claude-3-7-sonnet-20250219 | 0.623 | 3 | 15 |
| anthropic | claude-3-5-sonnet-20241022 | 0.49 | 3 | 15 |
| anthropic | claude-sonnet-4-5-20250929 | 0.73 | 3 | 15 |
| anthropic | claude-haiku-4-5-20251001 | 0.45 | 1 | 5 |
| claude-code | opus | 0.725 | 0 | 0 |
| claude-code | sonnet | 0.727 | 0 | 0 |
| claude-code | haiku | 0.45 | 0 | 0 |
| codex-cli | gpt-5 | 0.749 | 0 | 0 |
| codex-cli | gpt-5-codex | 0.749 | 0 | 0 |
| mcp | mcp-sampling | — | 0 | 0 |

View File

@@ -78,7 +78,7 @@ function log(level, ...args) {
// is responsible for directing logs correctly (e.g., to stderr)
// during tool execution without upsetting the client connection.
// Logs outside of tool execution (like startup) will go to stdout.
console.log(prefix, ...coloredArgs);
console.error(prefix, ...coloredArgs);
}
}

View File

@@ -25,7 +25,7 @@ export interface LoggerConfig {
export class Logger {
private config: Required<LoggerConfig>;
private static readonly DEFAULT_CONFIG: Required<LoggerConfig> = {
level: LogLevel.WARN,
level: LogLevel.SILENT,
silent: false,
prefix: '',
timestamp: false,

View File

@@ -307,6 +307,20 @@ function validateProviderModelCombination(providerName, modelId) {
);
}
/**
* Gets the list of supported model IDs for a given provider from supported-models.json
* @param {string} providerName - The name of the provider (e.g., 'claude-code', 'anthropic')
* @returns {string[]} Array of supported model IDs, or empty array if provider not found
*/
export function getSupportedModelsForProvider(providerName) {
if (!MODEL_MAP[providerName]) {
return [];
}
return MODEL_MAP[providerName]
.filter((model) => model.supported !== false)
.map((model) => model.id);
}
/**
* Validates Claude Code AI provider custom settings
* @param {object} settings The settings to validate

View File

@@ -43,6 +43,28 @@
"allowed_roles": ["main", "fallback"],
"max_tokens": 8192,
"supported": true
},
{
"id": "claude-sonnet-4-5-20250929",
"swe_score": 0.73,
"cost_per_1m_tokens": {
"input": 3.0,
"output": 15.0
},
"allowed_roles": ["main", "fallback"],
"max_tokens": 64000,
"supported": true
},
{
"id": "claude-haiku-4-5-20251001",
"swe_score": 0.45,
"cost_per_1m_tokens": {
"input": 1.0,
"output": 5.0
},
"allowed_roles": ["main", "fallback"],
"max_tokens": 200000,
"supported": true
}
],
"claude-code": [
@@ -67,6 +89,17 @@
"allowed_roles": ["main", "fallback", "research"],
"max_tokens": 64000,
"supported": true
},
{
"id": "haiku",
"swe_score": 0.45,
"cost_per_1m_tokens": {
"input": 0,
"output": 0
},
"allowed_roles": ["main", "fallback", "research"],
"max_tokens": 200000,
"supported": true
}
],
"codex-cli": [

View File

@@ -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

View File

@@ -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;

View File

@@ -43,9 +43,9 @@ describe('Claude Code Error Handling', () => {
// These should work even if CLI is not available
expect(provider.name).toBe('Claude Code');
expect(provider.getSupportedModels()).toEqual(['sonnet', 'opus']);
expect(provider.getSupportedModels()).toEqual(['opus', 'sonnet', 'haiku']);
expect(provider.isModelSupported('sonnet')).toBe(true);
expect(provider.isModelSupported('haiku')).toBe(false);
expect(provider.isModelSupported('haiku')).toBe(true);
expect(provider.isRequiredApiKey()).toBe(false);
expect(() => provider.validateAuth()).not.toThrow();
});

View File

@@ -40,14 +40,14 @@ describe('Claude Code Integration (Optional)', () => {
it('should create a working provider instance', () => {
const provider = new ClaudeCodeProvider();
expect(provider.name).toBe('Claude Code');
expect(provider.getSupportedModels()).toEqual(['sonnet', 'opus']);
expect(provider.getSupportedModels()).toEqual(['opus', 'sonnet', 'haiku']);
});
it('should support model validation', () => {
const provider = new ClaudeCodeProvider();
expect(provider.isModelSupported('sonnet')).toBe(true);
expect(provider.isModelSupported('opus')).toBe(true);
expect(provider.isModelSupported('haiku')).toBe(false);
expect(provider.isModelSupported('haiku')).toBe(true);
expect(provider.isModelSupported('unknown')).toBe(false);
});

View File

@@ -28,6 +28,14 @@ jest.unstable_mockModule('../../../src/ai-providers/base-provider.js', () => ({
}
}));
// Mock config getters
jest.unstable_mockModule('../../../scripts/modules/config-manager.js', () => ({
getClaudeCodeSettingsForCommand: jest.fn(() => ({})),
getSupportedModelsForProvider: jest.fn(() => ['opus', 'sonnet', 'haiku']),
getDebugFlag: jest.fn(() => false),
getLogLevel: jest.fn(() => 'info')
}));
// Import after mocking
const { ClaudeCodeProvider } = await import(
'../../../src/ai-providers/claude-code.js'
@@ -96,13 +104,13 @@ describe('ClaudeCodeProvider', () => {
describe('model support', () => {
it('should return supported models', () => {
const models = provider.getSupportedModels();
expect(models).toEqual(['sonnet', 'opus']);
expect(models).toEqual(['opus', 'sonnet', 'haiku']);
});
it('should check if model is supported', () => {
expect(provider.isModelSupported('sonnet')).toBe(true);
expect(provider.isModelSupported('opus')).toBe(true);
expect(provider.isModelSupported('haiku')).toBe(false);
expect(provider.isModelSupported('haiku')).toBe(true);
expect(provider.isModelSupported('unknown')).toBe(false);
});
});

View File

@@ -20,6 +20,7 @@ jest.unstable_mockModule('ai-sdk-provider-codex-cli', () => ({
// Mock config getters
jest.unstable_mockModule('../../../scripts/modules/config-manager.js', () => ({
getCodexCliSettingsForCommand: jest.fn(() => ({ allowNpx: true })),
getSupportedModelsForProvider: jest.fn(() => ['gpt-5', 'gpt-5-codex']),
// Provide commonly imported getters to satisfy other module imports if any
getDebugFlag: jest.fn(() => false),
getLogLevel: jest.fn(() => 'info')