mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
feat(byok): Added Ollama CLoud as BYOK provider (#923)
* feat: add Ollama Cloud to KNOWN_PROVIDERS as OpenAI-compatible BYOK provider * feat: add ollama.com to isOpenAICompatible base URL detection * feat: add Ollama Cloud models to SUGGESTED_MODELS_BY_PROTOCOL fallback list * fix: use full Ollama Cloud model list from /api/tags, drop -cloud suffix * feat: add Ollama Cloud as native protocol with NDJSON streaming and connection test support * fix: remove ollama.com from OpenAI compatibility check * feat: add token overrides for Ollama Cloud models to prevent truncation * fix: extend inferApiProtocol and legacy migration to recognize ollama.com base URLs * fix: normalize Ollama Cloud base URL by stripping /api suffix during migration and in daemon --------- Co-authored-by: herediaron <aronheredi346@gmail.com>
This commit is contained in:
co-authored by
herediaron
parent
64ed8e7046
commit
66f84972cf
@@ -190,6 +190,53 @@ export const KNOWN_PROVIDERS: KnownProvider[] = [
|
||||
model: 'mimo-v2.5-pro',
|
||||
models: ['mimo-v2.5-pro'],
|
||||
},
|
||||
{
|
||||
label: 'Ollama Cloud',
|
||||
protocol: 'ollama',
|
||||
baseUrl: 'https://ollama.com',
|
||||
model: 'gpt-oss:120b',
|
||||
models: [
|
||||
'cogito-2.1:671b',
|
||||
'deepseek-v3.1:671b',
|
||||
'deepseek-v3.2',
|
||||
'deepseek-v4-flash',
|
||||
'deepseek-v4-pro',
|
||||
'devstral-2:123b',
|
||||
'devstral-small-2:24b',
|
||||
'gemini-3-flash-preview',
|
||||
'gemma3:4b',
|
||||
'gemma3:12b',
|
||||
'gemma3:27b',
|
||||
'gemma4:31b',
|
||||
'glm-4.6',
|
||||
'glm-4.7',
|
||||
'glm-5',
|
||||
'glm-5.1',
|
||||
'gpt-oss:20b',
|
||||
'gpt-oss:120b',
|
||||
'kimi-k2:1t',
|
||||
'kimi-k2-thinking',
|
||||
'kimi-k2.5',
|
||||
'kimi-k2.6',
|
||||
'minimax-m2',
|
||||
'minimax-m2.1',
|
||||
'minimax-m2.5',
|
||||
'minimax-m2.7',
|
||||
'ministral-3:3b',
|
||||
'ministral-3:8b',
|
||||
'ministral-3:14b',
|
||||
'mistral-large-3:675b',
|
||||
'nemotron-3-nano:30b',
|
||||
'nemotron-3-super',
|
||||
'qwen3-coder:480b',
|
||||
'qwen3-coder-next',
|
||||
'qwen3-next:80b',
|
||||
'qwen3-vl:235b',
|
||||
'qwen3-vl:235b-instruct',
|
||||
'qwen3.5:397b',
|
||||
'rnj-1:8b',
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'MiMo (Xiaomi) — Anthropic',
|
||||
protocol: 'anthropic',
|
||||
@@ -233,6 +280,11 @@ function isValidOrbitTime(time: string): boolean {
|
||||
|
||||
function inferApiProtocol(model: string, baseUrl: string): ApiProtocol {
|
||||
try {
|
||||
const normalized = (baseUrl || '').toLowerCase();
|
||||
// Any config pointing at ollama.com should resolve to the new ollama
|
||||
// protocol so both chat and the connection test hit the native Ollama
|
||||
// proxy instead of the Anthropic or OpenAI paths.
|
||||
if (normalized.includes('ollama.com')) return 'ollama';
|
||||
return isOpenAICompatible(model, baseUrl) ? 'openai' : 'anthropic';
|
||||
} catch {
|
||||
// Preserve the rest of the user's settings even if an old saved base URL is
|
||||
@@ -286,6 +338,14 @@ export function loadConfig(): AppConfig {
|
||||
// legacy config can be migrated when it is loaded.
|
||||
if (!parsedHasApiProtocol) {
|
||||
merged.apiProtocol = inferApiProtocol(merged.model, merged.baseUrl);
|
||||
// Ollama Cloud legacy configs may carry a base URL that includes
|
||||
// /api or /api/ — normalize to the host root so the daemon's own
|
||||
// /api/chat appending doesn't double up.
|
||||
if (merged.apiProtocol === 'ollama') {
|
||||
merged.baseUrl = merged.baseUrl
|
||||
.replace(/\/api\/?$/, '')
|
||||
.replace(/\/+$/, '');
|
||||
}
|
||||
// Also set apiProviderBaseUrl so setApiProtocol() can correctly identify
|
||||
// whether the user is on a known provider and switch defaults appropriately.
|
||||
// null means "custom/unknown provider" so the protocol switch won't override
|
||||
|
||||
@@ -31,6 +31,48 @@ const OVERRIDES: Record<string, number> = {
|
||||
// Spec: https://platform.deepseek.com/docs/model-cards
|
||||
'deepseek-v4-pro': 384000,
|
||||
'deepseek-v4-flash': 384000,
|
||||
|
||||
// Ollama Cloud models. LiteLLM keys this set under `ollama/`-prefixed
|
||||
// ids (many with `-cloud` suffixes), so the bare model-id lookups never
|
||||
// match. Add overrides so chat doesn't silently clip at 8192 tokens.
|
||||
// 131072 (128k) is a safe floor for all Ollama Cloud models.
|
||||
'cogito-2.1:671b': 131072,
|
||||
'deepseek-v3.1:671b': 163840,
|
||||
'deepseek-v3.2': 163840,
|
||||
'devstral-2:123b': 131072,
|
||||
'devstral-small-2:24b': 131072,
|
||||
'gemini-3-flash-preview': 131072,
|
||||
'gemma3:4b': 131072,
|
||||
'gemma3:12b': 131072,
|
||||
'gemma3:27b': 131072,
|
||||
'gemma4:31b': 131072,
|
||||
'glm-4.6': 131072,
|
||||
'glm-4.7': 131072,
|
||||
'glm-5': 131072,
|
||||
'glm-5.1': 131072,
|
||||
'gpt-oss:20b': 131072,
|
||||
'gpt-oss:120b': 131072,
|
||||
'kimi-k2:1t': 131072,
|
||||
'kimi-k2-thinking': 131072,
|
||||
'kimi-k2.5': 131072,
|
||||
'kimi-k2.6': 131072,
|
||||
'minimax-m2': 131072,
|
||||
'minimax-m2.1': 131072,
|
||||
'minimax-m2.5': 131072,
|
||||
'minimax-m2.7': 131072,
|
||||
'ministral-3:3b': 131072,
|
||||
'ministral-3:8b': 131072,
|
||||
'ministral-3:14b': 131072,
|
||||
'mistral-large-3:675b': 131072,
|
||||
'nemotron-3-nano:30b': 131072,
|
||||
'nemotron-3-super': 131072,
|
||||
'qwen3-coder:480b': 262144,
|
||||
'qwen3-coder-next': 131072,
|
||||
'qwen3-next:80b': 131072,
|
||||
'qwen3-vl:235b': 131072,
|
||||
'qwen3-vl:235b-instruct': 131072,
|
||||
'qwen3.5:397b': 131072,
|
||||
'rnj-1:8b': 131072,
|
||||
};
|
||||
|
||||
export function modelMaxTokensDefault(model: string): number {
|
||||
|
||||
Reference in New Issue
Block a user