Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Chat: a DeepSeek Harness model without an API key here says so, and offers the account's model instead (#283)

WEBGRSde5a98bd46e2
diff --git a/.changeset/deepseek-route-without-key.md b/.changeset/deepseek-route-without-key.md
new file mode 100644
index 0000000..ba3aa53
--- /dev/null
+++ b/.changeset/deepseek-route-without-key.md
@@ -0,0 +1,5 @@
+---
+"@openfilm/desktop": patch
+---
+
+Chat: when a DeepSeek Harness model needs an API key this computer doesn't have (only a DeepSeek account is signed in), the chat says so in the app's language instead of showing DeepSeek Harness's own words, and offers a model of the account in its place. Once picked, that model is DeepSeek Harness's from then on, in new conversations too.
diff --git a/apps/desktop/chat/src/App.tsx b/apps/desktop/chat/src/App.tsx
index 901d5e0..814523a 100644
--- a/apps/desktop/chat/src/App.tsx
+++ b/apps/desktop/chat/src/App.tsx
@@ -61,6 +61,7 @@ import { readBalance, type TurnBalance } from '@/lib/balance';
import { BalanceNotice } from '@/components/BalanceNotice';
import { CopyDiagnostics } from '@/components/CopyDiagnostics';
import { accountName, accountTrouble } from '@/lib/account-trouble';
+import { accountModel, accountModelOf, routeWithoutKey } from '@/lib/route-without-key';
import { readStudioFilm } from '@/lib/studio-film';
import { studioRefsFromTransfer, transferHasStudioRefs } from '@/lib/studio-transfer';
import { agentModelSummary, agentOptions, currentAgent, effectivePrefs, offeredOption, useLocalAgents } from '@/state/local-agent-store';
@@ -798,6 +799,18 @@ function ChatPane({ project, banners, selection, assetsOpen }: { project: Projec
const failedOn = asset?.localAgent?.id ?? agent;
const switchFor = turnError && failedOn !== 'byok' && accountTrouble(turnError) && desktopBridge()?.openSettings
? { who: accountName(la.roster?.find((a) => a.id === failedOn)?.account) } : null;
+ /* DeepSeek Harness's model runs on an API key this computer has none of: said in the chat's words, and a model of
+ the person's DeepSeek account offered in its place, picked as the model menu picks it (for this agent from now on) */
+ const keyless = turnError && failedOn === 'deepseek' ? routeWithoutKey(turnError) : null;
+ const onAccount = keyless ? accountModel(agentOptions(la, 'deepseek')) : null;
+ /* any of the account's models counts, picked here or in the menu: the one they are on is named */
+ const onAccountPicked = onAccount ? accountModelOf(agentOptions(la, 'deepseek'), agentPrefs.deepseek?.[onAccount.configId]) : null;
+ const pickAccountModel = () => {
+ if (!onAccount) return;
+ la.setPref('deepseek', onAccount.configId, onAccount.value);
+ keepOnSession((s) => ({ agentPrefs: { ...s.agentPrefs, deepseek: { ...s.agentPrefs?.deepseek, [onAccount.configId]: onAccount.value } } }));
+ composerRef.current?.focus();
+ };
const wasName = agentWas === 'byok' ? t('composer.agentOwnKey') : agentWas ? la.roster?.find((a) => a.id === agentWas)?.name ?? AGENT_DEFINITIONS[agentWas]?.name ?? agentWas : '';
const editComposerCard = (
@@ -1102,7 +1115,16 @@ function ChatPane({ project, banners, selection, assetsOpen }: { project: Projec
) : null}
{turnError ? (
<p role="alert" className="text-xs text-[var(--err)]">
- {turnError}{' '}
+ {keyless ? t(onAccount ? 'composer.routeNoKey' : 'composer.routeNoKeyNoAccount') : turnError}{' '}
+ {onAccount ? (
+ <span className="text-[var(--text-muted)]">
+ {onAccountPicked ? `${t('composer.accountModelPicked').replace('{model}', onAccountPicked.name)} ` : (
+ <><button type="button" onClick={pickAccountModel} className="underline underline-offset-2 hover:text-[var(--text)]">
+ {t('composer.useAccountModel').replace('{model}', onAccount.name)}
+ </button>{' '}</>
+ )}
+ </span>
+ ) : null}
{/* failed for its account: whose it is, and Settings → Agents to switch it */}
{switchFor ? (
<span className="text-[var(--text-muted)]">
diff --git a/apps/desktop/chat/src/i18n/locales/en-US.ts b/apps/desktop/chat/src/i18n/locales/en-US.ts
index 6a47c04..cc17257 100644
--- a/apps/desktop/chat/src/i18n/locales/en-US.ts
+++ b/apps/desktop/chat/src/i18n/locales/en-US.ts
@@ -161,6 +161,10 @@ export const enUS = {
diagnosticsCopied: 'Copied',
switchAccount: 'Switch account',
signedInAs: 'Signed in as {account}.',
+ routeNoKey: "This model needs a DeepSeek API key, and none is set up on this computer. If you're only signed in to a DeepSeek account, use one of its models.",
+ routeNoKeyNoAccount: 'This model needs a DeepSeek API key, and none is set up on this computer. Sign in to your DeepSeek account in DeepSeek Harness, or add an API key in its model settings.',
+ useAccountModel: 'Use {model}',
+ accountModelPicked: 'Switched to {model}. Send your message again.',
removeFile: 'Remove file',
removeImage: 'Remove image',
speed: 'Speed',
diff --git a/apps/desktop/chat/src/i18n/locales/es.ts b/apps/desktop/chat/src/i18n/locales/es.ts
index d6bcc9f..cdb8436 100644
--- a/apps/desktop/chat/src/i18n/locales/es.ts
+++ b/apps/desktop/chat/src/i18n/locales/es.ts
@@ -161,6 +161,10 @@ export const es: Words = {
diagnosticsCopied: 'Copiado',
switchAccount: 'Cambiar de cuenta',
signedInAs: 'Sesión iniciada como {account}.',
+ routeNoKey: 'Este modelo necesita una clave de API de DeepSeek y no hay ninguna configurada en este equipo. Si solo iniciaste sesión con una cuenta de DeepSeek, usa uno de sus modelos.',
+ routeNoKeyNoAccount: 'Este modelo necesita una clave de API de DeepSeek y no hay ninguna configurada en este equipo. Inicia sesión con tu cuenta de DeepSeek en DeepSeek Harness o añade una clave de API en su configuración de modelos.',
+ useAccountModel: 'Usar {model}',
+ accountModelPicked: 'Cambiado a {model}. Vuelve a enviar el mensaje.',
removeFile: 'Quitar archivo',
removeImage: 'Quitar imagen',
speed: 'Velocidad',
diff --git a/apps/desktop/chat/src/i18n/locales/ja.ts b/apps/desktop/chat/src/i18n/locales/ja.ts
index eb75d76..9b74b7f 100644
--- a/apps/desktop/chat/src/i18n/locales/ja.ts
+++ b/apps/desktop/chat/src/i18n/locales/ja.ts
@@ -161,6 +161,10 @@ export const ja: Words = {
diagnosticsCopied: 'コピーしました',
switchAccount: 'アカウントを切り替え',
signedInAs: '{account} でサインイン中です。',
+ routeNoKey: 'このモデルには DeepSeek の API キーが必要ですが、このコンピューターには設定されていません。DeepSeek アカウントにだけサインインしている場合は、アカウントのモデルを使ってください。',
+ routeNoKeyNoAccount: 'このモデルには DeepSeek の API キーが必要ですが、このコンピューターには設定されていません。DeepSeek Harness で DeepSeek アカウントにサインインするか、モデル設定で API キーを追加してください。',
+ useAccountModel: '{model} を使う',
+ accountModelPicked: '{model} に切り替えました。もう一度送信してください。',
removeFile: 'ファイルを削除',
removeImage: '画像を削除',
speed: '速度',
diff --git a/apps/desktop/chat/src/i18n/locales/ko.ts b/apps/desktop/chat/src/i18n/locales/ko.ts
index 8aa7d0b..42eeb56 100644
--- a/apps/desktop/chat/src/i18n/locales/ko.ts
+++ b/apps/desktop/chat/src/i18n/locales/ko.ts
@@ -157,6 +157,10 @@ export const ko: Words = {
diagnosticsCopied: '복사됨',
switchAccount: '계정 전환',
signedInAs: '{account}(으)로 로그인되어 있습니다.',
+ routeNoKey: '이 모델은 DeepSeek API 키가 필요하지만 이 컴퓨터에는 설정되어 있지 않습니다. DeepSeek 계정에만 로그인했다면 계정의 모델을 사용하세요.',
+ routeNoKeyNoAccount: '이 모델은 DeepSeek API 키가 필요하지만 이 컴퓨터에는 설정되어 있지 않습니다. DeepSeek Harness에서 DeepSeek 계정에 로그인하거나 모델 설정에 API 키를 추가하세요.',
+ useAccountModel: '{model} 사용',
+ accountModelPicked: '{model}(으)로 바꿨습니다. 메시지를 다시 보내세요.',
removeFile: '파일 제거',
removeImage: '이미지 제거',
speed: '속도',
diff --git a/apps/desktop/chat/src/i18n/locales/zh-CN.ts b/apps/desktop/chat/src/i18n/locales/zh-CN.ts
index 9154471..da60ff8 100644
--- a/apps/desktop/chat/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/chat/src/i18n/locales/zh-CN.ts
@@ -161,6 +161,10 @@ export const zhCN: Words = {
diagnosticsCopied: '已复制',
switchAccount: '切换账号',
signedInAs: '当前登录:{account}。',
+ routeNoKey: '这个模型要用 DeepSeek 的 API key,这台电脑上还没有配置。只登录了 DeepSeek 账号的话,换成账号里的模型就行。',
+ routeNoKeyNoAccount: '这个模型要用 DeepSeek 的 API key,这台电脑上还没有配置。请在 DeepSeek Harness 里登录 DeepSeek 账号,或在它的模型设置里填上 API key。',
+ useAccountModel: '换成 {model}',
+ accountModelPicked: '已换成 {model},再发一次即可。',
removeFile: '移除文件',
removeImage: '移除图片',
speed: '速度',
diff --git a/apps/desktop/chat/src/lib/route-without-key.ts b/apps/desktop/chat/src/lib/route-without-key.ts
new file mode 100644
index 0000000..2df4530
--- /dev/null
+++ b/apps/desktop/chat/src/lib/route-without-key.ts
@@ -0,0 +1,50 @@
+/**
+ * A turn DeepSeek Harness could not run because the model's route has no API key: `no API key for provider route
+ * "deepseek-official"`, its words when only the person's DeepSeek account is signed in and the model picked (its
+ * default) runs on the API. The chat says so in its own words and offers a model of the account instead. Read from
+ * the error's words, so a turn kept from before says it too.
+ */
+import type { LocalAgentSessionInfo } from './desktop-bridge';
+
+type ConfigOptions = NonNullable<LocalAgentSessionInfo['configOptions']>;
+
+const NO_KEY = /\bno API key for provider route "([^"]+)"/i;
+
+/**
+ * The DeepSeek route that has no key, or null when the turn failed for something else. Another provider's route (an
+ * OpenAI-compatible one the person added) is left to DeepSeek Harness's own words, which name the key it needs.
+ */
+export function routeWithoutKey(error: string | null | undefined): string | null {
+ const route = NO_KEY.exec(String(error ?? ''))?.[1] ?? null;
+ return route && /^deepseek/i.test(route) ? route : null;
+}
+
+type AccountModel = { configId: string; value: string; name: string };
+
+/** A model value's route: `["deepseek-account", "<model>"]` → `deepseek-account`. */
+function routeOf(value: unknown): unknown {
+ if (typeof value !== 'string') return null;
+ try { return (JSON.parse(value) as unknown[])?.[0]; } catch { return null; }
+}
+
+/** The menu's model choices that run on the person's DeepSeek account, named as its button names them. */
+function accountModels(options: ConfigOptions | undefined): AccountModel[] {
+ const option = options?.find((o) => o.category === 'model');
+ return (option?.options ?? []).flatMap((choice) => (choice && 'value' in choice && typeof choice.value === 'string' && routeOf(choice.value) === 'deepseek-account'
+ ? [{ configId: option!.id, value: choice.value, name: String(choice.name ?? choice.value).split(' · ')[0] }]
+ : []));
+}
+
+/**
+ * The first model on the person's DeepSeek account (its value is `["deepseek-account", "<model>"]`), named as the
+ * menu's button names it (the part before " · DeepSeek Account"); null when the agent offers none, as when no account
+ * is signed in.
+ */
+export function accountModel(options: ConfigOptions | undefined): AccountModel | null {
+ return accountModels(options)[0] ?? null;
+}
+
+/** The account's model the person is on now (`value`, picked here or in the menu), or null when it is not one of them. */
+export function accountModelOf(options: ConfigOptions | undefined, value: unknown): AccountModel | null {
+ return accountModels(options).find((model) => model.value === value) ?? null;
+}
diff --git a/apps/desktop/src/route-without-key.test.mjs b/apps/desktop/src/route-without-key.test.mjs
new file mode 100644
index 0000000..671c722
--- /dev/null
+++ b/apps/desktop/src/route-without-key.test.mjs
@@ -0,0 +1,47 @@
+import assert from 'node:assert/strict';
+import { test } from 'node:test';
+import { accountModel, accountModelOf, routeWithoutKey } from '../chat/src/lib/route-without-key.ts';
+
+test("DeepSeek Harness's words for a model whose route has no API key are told apart from other failures", () => {
+ assert.equal(routeWithoutKey('turn failed: llm-deepseek: no API key for provider route "deepseek-official"; store DEEPSEEK_API_KEY through the credentials service (the web Models page writes it), or export DEEPSEEK_API_KEY in the launching environment'), 'deepseek-official');
+ for (const error of [
+ 'Invalid API key',
+ 'Not logged in · Please run /login',
+ 'The agent did not accept the selected model.',
+ 'turn failed: llm-openai: no API key for provider route "openai-compatible"; store OPENAI_API_KEY through the credentials service',
+ '',
+ null,
+ ]) assert.equal(routeWithoutKey(error), null, String(error));
+ assert.equal(routeWithoutKey('no API key for provider route "deepseek-beta"'), 'deepseek-beta', "another of DeepSeek's routes");
+});
+
+test("the model offered in its place is the first of the person's DeepSeek account, named as the menu's button names it", () => {
+ const options = [
+ { id: 'model', name: 'Model', category: 'model', currentValue: '["deepseek-official","deepseek-v4-flash"]', options: [
+ { value: '["deepseek-official","deepseek-v4-flash"]', name: 'deepseek-v4-flash · DeepSeek' },
+ { value: '["deepseek-account","deepseek-flash"]', name: 'DeepSeek-V4.1-Flash · DeepSeek Account' },
+ { value: '["deepseek-account","deepseek-v4-pro"]', name: 'DeepSeek-V4-Pro · DeepSeek Account' },
+ ] },
+ { id: 'reasoning_effort', name: 'Reasoning effort', category: 'thought_level', currentValue: 'high', options: [{ value: 'high', name: 'High' }] },
+ ];
+ assert.deepEqual(accountModel(options), { configId: 'model', value: '["deepseek-account","deepseek-flash"]', name: 'DeepSeek-V4.1-Flash' });
+});
+
+test("any of the account's models counts as switched, named as the one the person is on", () => {
+ const options = [{ id: 'model', name: 'Model', category: 'model', options: [
+ { value: '["deepseek-official","deepseek-v4-flash"]', name: 'deepseek-v4-flash · DeepSeek' },
+ { value: '["deepseek-account","deepseek-flash"]', name: 'DeepSeek-V4.1-Flash · DeepSeek Account' },
+ { value: '["deepseek-account","deepseek-v4-pro"]', name: 'DeepSeek-V4-Pro · DeepSeek Account' },
+ ] }];
+ assert.equal(accountModelOf(options, '["deepseek-account","deepseek-v4-pro"]')?.name, 'DeepSeek-V4-Pro', 'picked in the menu');
+ assert.equal(accountModelOf(options, '["deepseek-account","deepseek-flash"]')?.name, 'DeepSeek-V4.1-Flash');
+ assert.equal(accountModelOf(options, '["deepseek-official","deepseek-v4-flash"]'), null, 'still on the API');
+ assert.equal(accountModelOf(options, undefined), null, 'nothing picked');
+});
+
+test('no account model is offered when the agent lists none, its options are not known yet, or a value is not a route', () => {
+ assert.equal(accountModel([{ id: 'model', name: 'Model', category: 'model', options: [{ value: '["deepseek-official","deepseek-v4-flash"]', name: 'deepseek-v4-flash · DeepSeek' }] }]), null);
+ assert.equal(accountModel([{ id: 'model', name: 'Model', category: 'model', options: [{ value: 'gpt-5', name: 'GPT-5' }, { value: 42, name: 'odd' }] }]), null);
+ assert.equal(accountModel(undefined), null);
+ assert.equal(accountModel([]), null);
+});