jbai-cli 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/jbai-proxy.js CHANGED
@@ -844,13 +844,27 @@ function handleGrazieOpenAIResponses({ req, res, jwt, endpoints, urlPath, startT
844
844
  return;
845
845
  }
846
846
 
847
- const model = parsed.model;
847
+ let model = parsed.model;
848
848
  if (!model || typeof model !== 'string') {
849
849
  res.writeHead(400, { 'Content-Type': 'application/json' });
850
850
  res.end(JSON.stringify({ error: { message: 'Missing required field: model', type: 'invalid_request_error' } }));
851
851
  return;
852
852
  }
853
853
 
854
+ // Apply model aliases (e.g. gpt-5.4 → gpt-5.3-codex-spark-preview)
855
+ if (config.MODEL_ALIASES[model]) {
856
+ const original = model;
857
+ model = config.MODEL_ALIASES[model];
858
+ log(`[grazie-openai-responses] alias: "${original}" → "${model}"`);
859
+ }
860
+
861
+ // Grazie profiles use "openai-" prefix and dashes instead of dots (e.g. gpt-5.3-codex → openai-gpt-5-3-codex)
862
+ if (!model.startsWith('openai-') && !model.startsWith('anthropic-') && !model.startsWith('google-') && !model.startsWith('xai-') && !model.startsWith('deepseek-') && !model.startsWith('grazie-')) {
863
+ const grazieProfile = 'openai-' + model.replace(/\./g, '-');
864
+ log(`[grazie-openai-responses] profile: "${model}" → "${grazieProfile}"`);
865
+ model = grazieProfile;
866
+ }
867
+
854
868
  // Responses API: map instructions + input/messages into OpenAI-like messages
855
869
  const openAiMessages = [];
856
870
  if (typeof parsed.instructions === 'string' && parsed.instructions.trim()) {
package/lib/config.js CHANGED
@@ -28,65 +28,99 @@ const ENDPOINTS = {
28
28
 
29
29
  // All models available from JetBrains AI Platform (Grazie)
30
30
  // Model names must match EXACTLY what the Grazie API accepts
31
- // Run 'node bin/test-models.js' to verify model availability
31
+ // Verified against Grazie staging profiles 2026-04-10
32
32
  const MODELS = {
33
+ // Claude Code: uses Anthropic /messages endpoint (Chat feature required)
33
34
  claude: {
34
35
  default: 'claude-sonnet-4-6',
35
36
  available: [
36
37
  'claude-opus-4-6',
37
38
  'claude-sonnet-4-6',
39
+ 'claude-opus-4-5',
40
+ 'claude-sonnet-4-5',
41
+ 'claude-haiku-4-5',
42
+ 'claude-opus-4-1',
43
+ 'claude-sonnet-4-0',
38
44
  ]
39
45
  },
46
+ // OpenCode: uses OpenAI /chat/completions endpoint (Chat feature required)
40
47
  openai: {
41
- // Chat/Completions models (used by OpenCode)
42
- // NOTE: codex-only models (gpt-5.x-codex) do NOT work on chat/completions
43
48
  default: 'gpt-5.4',
44
49
  available: [
45
50
  'gpt-5.4',
51
+ 'gpt-5.4-mini',
52
+ 'gpt-5.4-nano',
46
53
  'gpt-5.2',
47
- 'o3-2025-04-16',
54
+ 'gpt-5.1',
55
+ 'gpt-5',
56
+ 'gpt-5-mini',
57
+ 'gpt-5-nano',
58
+ 'o3',
59
+ 'o4-mini',
60
+ 'gpt-4.1',
61
+ 'gpt-4.1-mini',
62
+ 'gpt-4.1-nano',
48
63
  ]
49
64
  },
50
- // Codex CLI uses OpenAI models via the "responses" API (wire_api = "responses")
65
+ // Codex CLI: uses OpenAI /responses endpoint (Responses feature required)
66
+ // Includes both chat+responses models and codex-only models
51
67
  codex: {
52
68
  default: 'gpt-5.4',
53
69
  available: [
54
70
  'gpt-5.4',
71
+ 'gpt-5.4-mini',
72
+ 'gpt-5.4-nano',
55
73
  'gpt-5.3-codex',
74
+ 'gpt-5.3-codex-spark-preview',
75
+ 'gpt-5.2',
56
76
  'gpt-5.2-codex',
57
- 'o3-2025-04-16',
77
+ 'gpt-5.2-pro',
78
+ 'gpt-5.1',
79
+ 'gpt-5.1-codex',
80
+ 'gpt-5.1-codex-mini',
81
+ 'gpt-5.1-codex-max',
82
+ 'gpt-5',
83
+ 'gpt-5-codex',
84
+ 'gpt-5-mini',
85
+ 'gpt-5-nano',
86
+ 'o3',
87
+ 'o4-mini',
88
+ 'gpt-4.1',
89
+ 'gpt-4.1-mini',
90
+ 'gpt-4.1-nano',
58
91
  ]
59
92
  },
60
93
  gemini: {
61
94
  default: 'gemini-2.5-pro',
62
95
  available: [
63
96
  'gemini-3.1-pro-preview',
64
- 'gemini-3-pro-preview',
97
+ 'gemini-3-flash-preview',
98
+ 'gemini-3.1-flash-lite-preview',
65
99
  'gemini-2.5-pro',
66
100
  'gemini-2.5-flash',
101
+ 'gemini-2.5-flash-lite',
102
+ 'gemini-2.0-flash',
103
+ 'gemini-2.0-flash-lite',
67
104
  ]
68
105
  },
69
106
  // Grazie native Chat API models — accessible via /grazie-openai/v1 translation layer.
70
107
  // Full list is dynamic (fetched from /user/v5/llm/profiles), this is a static fallback.
71
- // Only coding-capable models with tool use support.
72
108
  grazie: {
73
109
  default: 'xai-grok-4',
74
110
  available: [
75
111
  'xai-grok-4',
112
+ 'xai-grok-4-fast',
113
+ 'xai-grok-4-1-fast',
114
+ 'xai-grok-4-1-fast-non-reasoning',
76
115
  'xai-grok-code-fast-1',
77
116
  'deepseek-r1',
78
117
  ]
79
118
  }
80
119
  };
81
120
 
82
- // Model aliases: some CLI tools send short names that Grazie doesn't recognise yet.
83
- // Map them to the Grazie-accepted equivalents so the proxy can rewrite on the fly.
84
- const MODEL_ALIASES = {
85
- // Temporary compatibility mapping: staging currently exposes GPT-5.4 as spark preview.
86
- // Keep user-facing defaults on gpt-5.4 and rewrite at the proxy edge.
87
- 'gpt-5.4': 'gpt-5.3-codex-spark-preview',
88
- 'openai-gpt-5-4': 'gpt-5.3-codex-spark-preview',
89
- };
121
+ // Model aliases: map short names to Grazie-accepted equivalents.
122
+ // gpt-5.4 now works natively on staging no alias needed.
123
+ const MODEL_ALIASES = {};
90
124
 
91
125
  // All models for tools that support multiple providers (OpenCode, Codex)
92
126
  const ALL_MODELS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jbai-cli",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "CLI wrappers to use AI coding tools (Claude Code, Codex, Gemini CLI, OpenCode, Goose, Continue) with JetBrains AI Platform",
5
5
  "keywords": [
6
6
  "jetbrains",