@heventure/model-provider-x 0.2.6-beta.0 → 0.2.7-beta.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.
@@ -1,10 +1,26 @@
1
1
  const providerPresets = [
2
- { id: "unsloth", name: "Unsloth Local", baseURL: "http://localhost:8888/v1", apiKeyRequired: false },
3
- { id: "lmstudio", name: "LM Studio", baseURL: "http://localhost:1234/v1", apiKeyRequired: false },
4
- { id: "ollama", name: "Ollama", baseURL: "http://localhost:11434/v1", apiKeyRequired: false },
5
- { id: "vllm", name: "vLLM", baseURL: "http://localhost:8000/v1", apiKeyRequired: false },
6
- { id: "openai", name: "OpenAI", baseURL: "https://api.openai.com/v1", apiKeyRequired: true },
7
- { id: "openrouter", name: "OpenRouter", baseURL: "https://openrouter.ai/api/v1", apiKeyRequired: true }
2
+ // Local providers
3
+ { id: "unsloth", name: "Unsloth Local", baseURL: "http://localhost:8888/v1", apiKeyRequired: false, category: "local" },
4
+ { id: "lmstudio", name: "LM Studio", baseURL: "http://localhost:1234/v1", apiKeyRequired: false, category: "local" },
5
+ { id: "ollama", name: "Ollama", baseURL: "http://localhost:11434/v1", apiKeyRequired: false, category: "local" },
6
+ { id: "vllm", name: "vLLM", baseURL: "http://localhost:8000/v1", apiKeyRequired: false, category: "local" },
7
+ // Cloud providers
8
+ { id: "openai", name: "OpenAI", baseURL: "https://api.openai.com/v1", apiKeyRequired: true, category: "cloud" },
9
+ { id: "anthropic", name: "Anthropic", baseURL: "https://api.anthropic.com/v1", apiKeyRequired: true, category: "cloud" },
10
+ { id: "google", name: "Google AI", baseURL: "https://generativelanguage.googleapis.com/v1", apiKeyRequired: true, category: "cloud" },
11
+ { id: "deepseek", name: "DeepSeek", baseURL: "https://api.deepseek.com/v1", apiKeyRequired: true, category: "cloud" },
12
+ { id: "mistral", name: "Mistral AI", baseURL: "https://api.mistral.ai/v1", apiKeyRequired: true, category: "cloud" },
13
+ { id: "groq", name: "Groq", baseURL: "https://api.groq.com/openai/v1", apiKeyRequired: true, category: "cloud" },
14
+ { id: "together", name: "Together AI", baseURL: "https://api.together.xyz/v1", apiKeyRequired: true, category: "cloud" },
15
+ { id: "fireworks", name: "Fireworks AI", baseURL: "https://api.fireworks.ai/inference/v1", apiKeyRequired: true, category: "cloud" },
16
+ { id: "xai", name: "xAI (Grok)", baseURL: "https://api.x.ai/v1", apiKeyRequired: true, category: "cloud" },
17
+ { id: "cohere", name: "Cohere", baseURL: "https://api.cohere.ai/v1", apiKeyRequired: true, category: "cloud" },
18
+ { id: "alibaba", name: "Alibaba Qwen", baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1", apiKeyRequired: true, category: "cloud" },
19
+ // Gateways
20
+ { id: "openrouter", name: "OpenRouter", baseURL: "https://openrouter.ai/api/v1", apiKeyRequired: true, category: "gateway" },
21
+ { id: "requesty", name: "Requesty", baseURL: "https://router.requesty.ai/v1", apiKeyRequired: true, category: "gateway" },
22
+ { id: "siliconflow", name: "SiliconFlow", baseURL: "https://api.siliconflow.cn/v1", apiKeyRequired: true, category: "gateway" },
23
+ { id: "nvidia", name: "NVIDIA NIM", baseURL: "https://integrate.api.nvidia.com/v1", apiKeyRequired: true, category: "gateway" }
8
24
  ];
9
25
  export function getProviderPresets() {
10
26
  return [...providerPresets];
@@ -13,8 +29,21 @@ export function getProviderPreset(id) {
13
29
  return providerPresets.find((preset) => preset.id === id);
14
30
  }
15
31
  export function createProviderChoices() {
32
+ const localProviders = providerPresets.filter((p) => p.category === "local");
33
+ const cloudProviders = providerPresets.filter((p) => p.category === "cloud");
34
+ const gatewayProviders = providerPresets.filter((p) => p.category === "gateway");
16
35
  return [
17
- ...providerPresets.map((preset) => ({
36
+ ...localProviders.map((preset) => ({
37
+ label: preset.name,
38
+ value: preset.id,
39
+ hint: preset.baseURL
40
+ })),
41
+ ...cloudProviders.map((preset) => ({
42
+ label: preset.name,
43
+ value: preset.id,
44
+ hint: preset.baseURL
45
+ })),
46
+ ...gatewayProviders.map((preset) => ({
18
47
  label: preset.name,
19
48
  value: preset.id,
20
49
  hint: preset.baseURL
@@ -108,6 +108,7 @@ function normalizeRegistryModel(modelId, model, source) {
108
108
  parameterSize: model.parameterSize,
109
109
  state: model.state,
110
110
  contextLength: model.contextLength ?? model.limit?.context,
111
+ maxOutputTokens: model.limit?.output,
111
112
  modalities,
112
113
  capabilities: toolCall || reasoning ? { toolCall, reasoning } : undefined,
113
114
  metadataSources: [source]
@@ -136,6 +137,7 @@ function mergeRegistryInfo(base, next) {
136
137
  parameterSize: next.parameterSize ?? base.parameterSize,
137
138
  state: next.state ?? base.state,
138
139
  contextLength: next.contextLength ?? base.contextLength,
140
+ maxOutputTokens: next.maxOutputTokens ?? base.maxOutputTokens,
139
141
  modalities: next.modalities ?? base.modalities,
140
142
  capabilities: base.capabilities || next.capabilities
141
143
  ? {
@@ -215,6 +217,7 @@ function cleanModelInfo(model) {
215
217
  ...(model.parameterSize ? { parameterSize: model.parameterSize } : {}),
216
218
  ...(model.state ? { state: model.state } : {}),
217
219
  ...(model.contextLength ? { contextLength: model.contextLength } : {}),
220
+ ...(model.maxOutputTokens ? { maxOutputTokens: model.maxOutputTokens } : {}),
218
221
  ...(model.modalities ? { modalities: model.modalities } : {}),
219
222
  ...(capabilities ? { capabilities } : {}),
220
223
  ...(model.metadataSources?.length ? { metadataSources: model.metadataSources } : {})
@@ -127,8 +127,11 @@ function buildModelConfig(modelId, modelInfo) {
127
127
  if (modelInfo?.capabilities?.toolCall) {
128
128
  config.tool_call = true;
129
129
  }
130
- if (modelInfo?.contextLength) {
131
- config.limit = { context: modelInfo.contextLength };
130
+ if (modelInfo?.contextLength || modelInfo?.maxOutputTokens) {
131
+ config.limit = {
132
+ ...(modelInfo.contextLength ? { context: modelInfo.contextLength } : {}),
133
+ ...(modelInfo.maxOutputTokens ? { output: modelInfo.maxOutputTokens } : {})
134
+ };
132
135
  }
133
136
  return config;
134
137
  }
@@ -196,6 +199,7 @@ function normalizeModelInfo(raw, source) {
196
199
  const modalities = parseCapabilitiesFromApi(raw);
197
200
  const type = stringValue(raw.type);
198
201
  const contextLength = numberValue(raw.max_context_length ?? raw.context_length ?? raw.contextLength);
202
+ const maxOutputTokens = numberValue(raw.max_output_tokens ?? raw.maxOutputTokens ?? raw.output_limit);
199
203
  const toolCall = capabilityFlag(raw.tool_call ??
200
204
  raw.tool_calls ??
201
205
  raw.toolCall ??
@@ -216,6 +220,7 @@ function normalizeModelInfo(raw, source) {
216
220
  parameterSize: stringValue(raw.params_string ?? raw.paramsString ?? raw.parameterSize),
217
221
  state: stringValue(raw.state) ?? (Array.isArray(raw.loaded_instances) && raw.loaded_instances.length > 0 ? "loaded" : undefined),
218
222
  contextLength,
223
+ maxOutputTokens,
219
224
  modalities,
220
225
  capabilities: toolCall || reasoning ? { toolCall, reasoning } : undefined,
221
226
  metadataSources: [source]
@@ -251,6 +256,7 @@ function mergeModelInfo(base, next) {
251
256
  parameterSize: next.parameterSize ?? base.parameterSize,
252
257
  state: next.state ?? base.state,
253
258
  contextLength: next.contextLength ?? base.contextLength,
259
+ maxOutputTokens: next.maxOutputTokens ?? base.maxOutputTokens,
254
260
  modalities: next.modalities ?? base.modalities,
255
261
  capabilities: base.capabilities || next.capabilities
256
262
  ? {
@@ -288,6 +294,7 @@ function cleanModelInfo(model) {
288
294
  ...(model.parameterSize ? { parameterSize: model.parameterSize } : {}),
289
295
  ...(model.state ? { state: model.state } : {}),
290
296
  ...(model.contextLength ? { contextLength: model.contextLength } : {}),
297
+ ...(model.maxOutputTokens ? { maxOutputTokens: model.maxOutputTokens } : {}),
291
298
  ...(model.modalities ? { modalities: model.modalities } : {}),
292
299
  ...(capabilities ? { capabilities } : {}),
293
300
  ...(model.metadataSources?.length ? { metadataSources: model.metadataSources } : {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heventure/model-provider-x",
3
- "version": "0.2.6-beta.0",
3
+ "version": "0.2.7-beta.0",
4
4
  "description": "TUI configurator and local API proxy for wiring custom model providers into OpenCode and Claude Code.",
5
5
  "private": false,
6
6
  "license": "MIT",