Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .context/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ density="rail"` (the group caption with its chevron) and `DashNavItem density="r
component under the canvas chrome's name. `AvatarStack` (the first `max` people plus a "+N"
disc), `tone="ink"` (the account's own face: initials on an ink disc, no collar), `initials()`
(the one first-and-last-letter rule), `BrandMark` - every third-party logo (`<BrandMark brand="figma" size={16} />`; figma, github,
canva, photoshop, meta, claude, openai, cursor, gemini, google, apple, microsoft, slack, linear, openrouter);
canva, photoshop, meta, claude, openai, cursor, gemini, google, apple, microsoft, slack, linear, openrouter,
deepseek, kimi);
`AppIcon` is a model provider, import source or export format as doop.design's "Works with" row draws it:
the brand tile (23% corners, inset edge and soft drop) with its glyph at 56% (`claude`, `claude-code`, `openai`,
`gemini`, `openrouter`, `seedream`, `codex`, `cursor`, `mcp`, `headless`, `github`, `figma`, `photoshop`, `canva`, `website`, `live-app`, `pdf`, `png`, `svg`,
`gemini`, `openrouter`, `deepseek`, `kimi`, `seedream`, `codex`, `cursor`, `mcp`, `headless`, `github`, `figma`, `photoshop`, `canva`, `website`, `live-app`, `pdf`, `png`, `svg`,
`jpg`), 32px in a list row and 40px beside a modal title,
`Wordmark`, `Logo` / `DoopMark` (the bare Disc-D; `animated` hops its dot, as the home greeting
wears it), `icons.tsx` - identity. Feature tiles (`FigmaTile`, `MetaTile`, the integrations'
Expand Down
11 changes: 9 additions & 2 deletions .context/TECHSTACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@
catalog, `CHATGPT_MODELS_URL`, asked with the account's token as Codex CLI
`CHATGPT_CODEX_CLIENT_VERSION`; the route refreshes the token first) have loaders, each with a
family filter for reasoning chat models with tools, images and a 16k output window; a picked id
only has to be shaped like the provider's, and the run is the final check. OpenRouter stays on
its curated roster (the run-time vision check knows only the roster's flags).
only has to be shaped like the provider's, and the run is the final check. OpenRouter, DeepSeek,
Kimi and Kimi Code stay on their curated rosters (the run-time vision check knows only the roster's flags).
- DeepSeek and Kimi keys (`deepseek-key`, `kimi-key`) and the Kimi Code plan (`kimi-code`, a
Kimi membership's key, sent with a `Doop/<version>` User-Agent as Kimi Code's terms require)
run on the Chat Completions transport (`server/chatCompletionsAgent.ts`) against fixed URLs
(`DEEPSEEK_CHAT_URL`, `KIMI_CHAT_URL`, `KIMI_CODE_CHAT_URL`, an operator's override only). Both refuse a tool-calling conversation that drops an earlier turn's
`reasoning_content`, so the transport keeps it as a `thinking` block in the run's history and
sends it back where the config sets `echoReasoning`. Tests: the `reasoning_content` cases in
`chatCompletionsAgent.test.ts`, `rosterRouting.test.ts`, `providerKeyAccounts.test.ts`.
- Reasoning effort on a user's OpenAI account (ChatGPT subscription or OpenAI key): the pick lives
in `model_accounts.reasoning_effort` (`REASONING_EFFORTS` in `shared/modelMenu.ts`: low / medium /
high / xhigh), set through `PATCH /api/model-account/:kind { effort }`, read by `effortFor` in
Expand Down
15 changes: 12 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,15 @@
# user starts on; they pick low / medium / high / xhigh for themselves in
# Settings or the composer, on a ChatGPT subscription or an OpenAI key.
#DOOP_AGENT_OPENAI_EFFORT=medium
# Default models for the two wide-roster BYO keys (users pick another in
# Settings). OpenRouter ids come from the curated roster in
# shared/modelMenu.ts; an off-roster override runs but is treated as
# Default models for the Chat Completions BYO keys (users pick another in
# Settings). OpenRouter, DeepSeek and Kimi ids come from the curated rosters
# in shared/modelMenu.ts; an off-roster override runs but is treated as
# text-only (no visual review) to be safe.
#DOOP_AGENT_OPENROUTER_MODEL=moonshotai/kimi-k2.6
#DOOP_AGENT_GEMINI_MODEL=gemini-3.7-flash
#DOOP_AGENT_DEEPSEEK_MODEL=deepseek-flash
#DOOP_AGENT_KIMI_MODEL=kimi-k3.1-pro
#DOOP_AGENT_KIMI_CODE_MODEL=k3.1-pro

# Experimental subscription-backed Gemini cloud workers. Operator-managed pilot;
# one isolated worker and credential volume per user. Disabled when unset.
Expand Down Expand Up @@ -413,6 +416,12 @@
#OPENROUTER_CHAT_URL=https://openrouter.ai/api/v1/chat/completions
#GEMINI_OPENAI_CHAT_URL=https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
#GEMINI_MODELS_URL=https://generativelanguage.googleapis.com/v1beta/models
#DEEPSEEK_CHAT_URL=https://api.deepseek.com/chat/completions
# Moonshot's international platform; keys from platform.moonshot.cn need
# https://api.moonshot.cn/v1/chat/completions instead.
#KIMI_CHAT_URL=https://api.moonshot.ai/v1/chat/completions
# Kimi Code (a Kimi membership's quota); China: https://api.kimi.com/coding/v1/chat/completions
#KIMI_CODE_CHAT_URL=https://api.kimi.ai/coding/v1/chat/completions
# Read by the Anthropic SDK itself: every Claude API call, including the
# connected-key model catalog behind the picker, goes to this origin.
#ANTHROPIC_BASE_URL=https://api.anthropic.com
Expand Down
34 changes: 24 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs on **GPT, Claude, Gemini, DeepSeek, Kimi or Qwen** models
then watch it sketch, stream and self-review designs on your canvas, next to your cursor.
- **A built-in Doop Agent** — queue a card or @mention a role and it designs on its own, no client
to connect. Runs on the model account each user connects (a **ChatGPT subscription**, or an
OpenAI, Claude, Gemini or OpenRouter key), or on the server's `ANTHROPIC_API_KEY` for as many
OpenAI, Claude, Gemini, DeepSeek, Kimi or OpenRouter key), or on the server's `ANTHROPIC_API_KEY` for as many
free tasks as `RESIDENT_TASK_LIMIT` grants (none by default) ([setup](#the-doop-agent)); the
first-canvas welcome performance is scripted and runs without any of it.
- **Pages within a canvas** — organize frames into named pages from the Layers panel. Add, rename,
Expand Down Expand Up @@ -79,8 +79,8 @@ tasks. **Connect AI** in the top bar walks you through each one.
| Headless agents (n8n, Mastra, CI) | An agent key as a bearer header ([setup](#headless-agents-agent-keys)) |

No agent of your own? The built-in [Doop Agent](#the-doop-agent) runs on the model account you
connect: a ChatGPT subscription, or an OpenAI, Claude, Gemini or OpenRouter key. OpenRouter brings
DeepSeek, Kimi, Qwen, GLM and MiniMax ([details](#past-the-free-tasks-connect-your-own-chatgpt)).
connect: a ChatGPT subscription, or an OpenAI, Claude, Gemini, DeepSeek, Kimi or OpenRouter key.
OpenRouter brings Qwen, GLM, MiniMax and more ([details](#past-the-free-tasks-connect-your-own-chatgpt)).

## Quickstart

Expand Down Expand Up @@ -396,7 +396,7 @@ from the very next task: the free tier is a trial that gets people here, not a b
first, and connecting stops costing the server anything from that moment. The connection is
account-level, so it lives at **/settings** (Home → Settings); the free-tier wall links there rather
than carrying its own copy, and "Connect an AI agent" on a canvas stays about MCP clients only. A
user can connect five kinds of account; the Gemini cloud pilot and Claude Plan appear only where
user can connect eight kinds of account; the Gemini cloud pilot and Claude Plan appear only where
the operator or the desktop app provides them:

- **ChatGPT subscription** — OAuth against `auth.openai.com`, then inference through the Codex
Expand All @@ -410,6 +410,15 @@ the operator or the desktop app provides them:
the picker labels them "no visual review".
- **Gemini API key** — Google's Gemini models through their OpenAI-compatible endpoint, plus Nano
Banana image generation.
- **DeepSeek API key** — DeepSeek V4.1 Flash (with vision) and V4 Pro (text-only for now) on the
user's own platform.deepseek.com account.
- **Kimi API key** — Moonshot's Kimi K3 models, all with vision, on the user's own
platform.moonshot.ai account. A key from Moonshot's China platform needs an operator to point
`KIMI_CHAT_URL` at `https://api.moonshot.cn/v1/chat/completions`.
- **Kimi Code plan** — a Kimi membership (Plus and up) through a key from the Kimi Code console,
billed to the membership rather than per token. Its own endpoint (`KIMI_CODE_CHAT_URL`,
`api.kimi.ai/coding/v1` overseas) and ids (`k3.1-pro`, `k3.1-pro-highspeed`, `k3`); requests
name Doop in their `User-Agent`, as Kimi Code's terms ask of every third-party tool.
- **Gemini cloud pilot** — an operator-managed prototype running the official Gemini CLI in an
isolated worker using Google sign-in. Disabled by default; see the
[pilot setup and verification guide](docs/gemini-cloud-pilot.md).
Expand All @@ -425,19 +434,21 @@ same list the Codex CLI reads, asked as `CHATGPT_CODEX_CLIENT_VERSION`), OpenAI'
Anthropic's `/v1/models`, Gemini's `/v1beta/models`. A newly released model is on the menu
without an upgrade; the curated entries above sit on top as recommendations, a curated tier the
account cannot run is left off, and the curated menu alone is served if the provider cannot be
reached. OpenRouter stays on its curated roster, whose hand-checked vision flags are what the
run relies on.
reached. OpenRouter, DeepSeek, Kimi and Kimi Code stay on their curated rosters, whose hand-checked vision
flags are what the run relies on. DeepSeek and Kimi return their reasoning as `reasoning_content`
and refuse a tool-calling conversation that leaves it out, so the transport keeps it in the run's
history and sends it back on every turn.

Azure OpenAI is deliberately _not_ a connectable account kind, and the OpenRouter/Gemini endpoints
are fixed constants: a user-supplied endpoint would be a URL the server fetches with the run's full
Azure OpenAI is deliberately _not_ a connectable account kind, and the OpenRouter/Gemini/DeepSeek/Kimi
endpoints are fixed constants: a user-supplied endpoint would be a URL the server fetches with the run's full
context — an SSRF vector — so custom endpoints stay server-level configuration only.

Either way the user picks their **model tier** in Settings from that provider's curated menu — on
OpenAI, `gpt-6-astra` (the newest flagship; on a ChatGPT subscription it needs Plus or better and
OpenAI is still rolling it out per account), `gpt-5.6-sol` (flagship), `gpt-5.6-terra` (the default
workhorse) or `gpt-5.6-luna` (cheap and fast). They are paying for it, so the choice is theirs;
`DOOP_AGENT_OPENAI_MODEL`, `DOOP_AGENT_OPENROUTER_MODEL` and `DOOP_AGENT_GEMINI_MODEL` only set the
default they start on. Note that
`DOOP_AGENT_OPENAI_MODEL`, `DOOP_AGENT_OPENROUTER_MODEL`, `DOOP_AGENT_GEMINI_MODEL`,
`DOOP_AGENT_DEEPSEEK_MODEL`, `DOOP_AGENT_KIMI_MODEL` and `DOOP_AGENT_KIMI_CODE_MODEL` only set the default they start on. Note that
`gpt-5.4` and `gpt-5.4-mini` retire from ChatGPT-authenticated Codex on **31 August 2026**, so
pinning a 5.4 id via that env var will break the subscription path after that date.

Expand Down Expand Up @@ -490,6 +501,9 @@ own agent over MCP.
| `DOOP_AGENT_OPENAI_EFFORT` | `medium` | Default reasoning effort on a user's OpenAI account; each user can pick low–xhigh |
| `DOOP_AGENT_OPENROUTER_MODEL` | `moonshotai/kimi-k2.6` | Default model on a connected OpenRouter key |
| `DOOP_AGENT_GEMINI_MODEL` | `gemini-3.7-flash` | Default model on a connected Gemini key |
| `DOOP_AGENT_DEEPSEEK_MODEL` | `deepseek-flash` | Default model on a connected DeepSeek key |
| `DOOP_AGENT_KIMI_MODEL` | `kimi-k3.1-pro` | Default model on a connected Kimi key |
| `DOOP_AGENT_KIMI_CODE_MODEL` | `k3.1-pro` | Default model on a connected Kimi Code plan |
| `CHATGPT_CONNECT_DISABLED` | _unset_ | `1` hides the ChatGPT flow, leaving the API-key path |
| `DOOP_DISTILL_MODEL` | `claude-haiku-4-5-20251001` | Model for the guideline distiller |

Expand Down
32 changes: 26 additions & 6 deletions server/agentModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import { withFreshToken, accountModelFor, accountVisionFor, accountWithPick } fr
import type { AccountKind, ModelAccount } from './modelAccounts.ts'
import { ModelAuthError, ModelUnavailableError, effortFor, runAzureTurn, runOpenAiTurn } from './openaiAgent.ts'
import type { StopReason, TurnBlock } from './openaiAgent.ts'
import { geminiConfig, openrouterConfig, runChatCompletionsTurn } from './chatCompletionsAgent.ts'
import {
deepseekConfig,
geminiConfig,
kimiCodeConfig,
kimiConfig,
openrouterConfig,
runChatCompletionsTurn,
type ChatCompletionsConfig,
} from './chatCompletionsAgent.ts'

/**
* Which model runs a Doop Agent turn, and on whose bill.
Expand Down Expand Up @@ -203,6 +211,20 @@ const BYO_LABELS: Record<AccountKind, string> = {
'anthropic-key': 'Claude API',
'openrouter-key': 'OpenRouter',
'gemini-key': 'Gemini',
'deepseek-key': 'DeepSeek',
'kimi-key': 'Kimi',
'kimi-code': 'Kimi Code',
}

/* the account kinds that run on the Chat Completions transport */
const CHAT_COMPLETIONS_CONFIGS: Partial<
Record<AccountKind, (apiKey: string, model: string, vision: boolean) => ChatCompletionsConfig>
> = {
'openrouter-key': openrouterConfig,
'gemini-key': geminiConfig,
'deepseek-key': deepseekConfig,
'kimi-key': kimiConfig,
'kimi-code': kimiCodeConfig,
}

/* the OpenAI-shaped transports take one system string; cache breakpoints are
Expand Down Expand Up @@ -241,14 +263,12 @@ function byoModel(account: ModelAccount): AgentModel {
},
}
}
if (account.kind === 'openrouter-key' || account.kind === 'gemini-key') {
const chatCompletionsConfig = CHAT_COMPLETIONS_CONFIGS[account.kind]
if (chatCompletionsConfig) {
if (!account.apiKey) throw new ModelAuthError(`Reconnect your ${BYO_LABELS[account.kind]} key in Settings.`)
const model = accountModelFor(account)
const vision = accountVisionFor(account)
const config =
account.kind === 'openrouter-key'
? openrouterConfig(account.apiKey, model, vision)
: geminiConfig(account.apiKey, model, vision)
const config = chatCompletionsConfig(account.apiKey, model, vision)
return {
provider: account.kind,
label: `${BYO_LABELS[account.kind]} (${model})`,
Expand Down
13 changes: 12 additions & 1 deletion server/agentRunners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ import {
type AccountStatus,
} from './modelAccounts.ts'
import { CLAUDE_EFFORT_OPTIONS, CLAUDE_MODELS } from '../shared/localAgent.ts'
import { ANTHROPIC_MODELS, GEMINI_MODELS, OPENROUTER_MODELS, reasoningEffortOptions } from '../shared/modelMenu.ts'
import {
ANTHROPIC_MODELS,
DEEPSEEK_MODELS,
GEMINI_MODELS,
KIMI_CODE_MODELS,
KIMI_MODELS,
OPENROUTER_MODELS,
reasoningEffortOptions,
} from '../shared/modelMenu.ts'
import type { ModelOption } from '../shared/modelMenu.ts'
import { RUNNER_NAMES, type AgentRunner, type AgentRunners, type RunnerProvider } from '../shared/agentRunner.ts'

Expand All @@ -29,6 +37,9 @@ export const MODEL_MENUS: Record<AccountKind, ModelOption[]> = {
'anthropic-key': ANTHROPIC_MODELS,
'openrouter-key': OPENROUTER_MODELS,
'gemini-key': GEMINI_MODELS,
'deepseek-key': DEEPSEEK_MODELS,
'kimi-key': KIMI_MODELS,
'kimi-code': KIMI_CODE_MODELS,
}

export async function listRunners(userId: string): Promise<AgentRunners> {
Expand Down
Loading
Loading