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
190 changes: 190 additions & 0 deletions app/resources/atc/models.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
[
{ "match": { "name": "(?:.*/)?glm[^/]*" },
"metadata": { "contextWindow": 1000000, "efforts": ["low", "high", "max"] } },
{ "match": { "name": "(?:.*/)?glm-5(?:-[0-9]{6,8})?" },
"metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "GLM-5\\.2.*" },
"metadata": { "contextWindow": 1000000, "efforts": ["high", "max"], "thinking": true } },
{ "match": { "name": "GLM-5-Turbo.*" }, "metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-5\\.3.*" }, "metadata": { "contextWindow": 1000000, "efforts": ["low", "high", "max"] } },
{ "match": { "name": "glm-5\\.1.*" }, "metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-5\\.1-highspeed.*" },
"metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-5v-turbo.*" }, "metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.7.*" }, "metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.7-flash.*" },
"metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.7-flashx.*" },
"metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.6.*" }, "metadata": { "contextWindow": 200000, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.5.*" }, "metadata": { "contextWindow": 131072, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.5-air.*" },
"metadata": { "contextWindow": 131072, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.6v.*" }, "metadata": { "contextWindow": 131072 } },
{ "match": { "name": "glm-4\\.6v-flash.*" }, "metadata": { "contextWindow": 131072 } },
{ "match": { "name": "glm-4\\.6v-flashx.*" }, "metadata": { "contextWindow": 131072 } },
{ "match": { "name": "glm-4\\.1v-thinking-flash.*" },
"metadata": { "contextWindow": 65536, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4\\.1v-thinking-flashx.*" }, "metadata": { "contextWindow": 65536 } },
{ "match": { "name": "glm-4-flashx-250414.*" },
"metadata": { "contextWindow": 131072, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4-flash-250414.*" },
"metadata": { "contextWindow": 131072, "efforts": [], "thinking": true } },
{ "match": { "name": "glm-4v-flash.*" }, "metadata": { "contextWindow": 16384, "efforts": [], "thinking": true } },

{ "match": { "name": "codegeex-4.*" }, "metadata": { "contextWindow": 131072 } },

{ "match": { "name": "charglm-4.*" }, "metadata": { "contextWindow": 8192 } },

{ "match": { "name": "emohaa.*" }, "metadata": { "contextWindow": 8192 } },

{ "match": { "name": "gpt-5\\.6.*" },
"metadata": { "contextWindow": 1050000, "efforts": ["none", "low", "medium", "high", "xhigh", "max"] } },
{ "match": { "name": "gpt-5\\.3-codex.*" },
"metadata": { "contextWindow": 400000, "efforts": ["low", "medium", "high", "xhigh"] } },
{ "match": { "name": "gpt-6-astra.*" },
"metadata": { "contextWindow": 1050000, "efforts": ["low", "medium", "high", "xhigh", "max"] } },
{ "match": { "name": "gpt-5\\.4.*" },
"metadata": { "contextWindow": 1050000, "efforts": ["none", "low", "medium", "high", "xhigh"] } },
{ "match": { "name": "gpt-5\\.4-pro.*" },
"metadata": { "contextWindow": 1050000, "efforts": ["medium", "high", "xhigh"] } },
{ "match": { "name": "gpt-5\\.4-mini.*" },
"metadata": { "contextWindow": 400000, "efforts": ["none", "low", "medium", "high", "xhigh"] } },
{ "match": { "name": "gpt-5\\.4-nano.*" },
"metadata": { "contextWindow": 400000, "efforts": ["none", "low", "medium", "high", "xhigh"] } },

{ "match": { "name": "claude-(?:fable|opus|sonnet)-5.*" },
"metadata": { "efforts": ["low", "medium", "high", "xhigh", "max"] } },
{ "match": { "name": "claude-haiku-4[.-]5.*" }, "metadata": { "contextWindow": 200000 } },
{ "match": { "name": "claude-(?:fable|mythos)-5[.-]1.*" },
"metadata": { "efforts": ["low", "medium", "high", "xhigh", "max"] } },

{ "match": { "name": "grok-4\\.6.*" },
"metadata": { "contextWindow": 500000, "efforts": ["low", "medium", "high", "xhigh"] } },
{ "match": { "name": "grok-build-0\\.1.*" }, "metadata": { "contextWindow": 256000 } },

{ "match": { "name": "kimi-k3.*" }, "metadata": { "contextWindow": 1048576, "efforts": ["low", "high", "max"] } },

{ "match": { "name": "k3.*" }, "metadata": { "contextWindow": 1048576, "efforts": ["low", "high", "max"] } },
{ "match": { "name": "k3-256k.*" }, "metadata": { "contextWindow": 262144, "efforts": ["low", "high", "max"] } },

{ "match": { "name": "kimi-k2\\.7-code.*" },
"metadata": { "contextWindow": 262144, "efforts": [], "thinking": true } },
{ "match": { "name": "kimi-k2\\.6.*" }, "metadata": { "contextWindow": 262144, "efforts": [], "thinking": true } },
{ "match": { "name": "kimi-k2\\.5.*" }, "metadata": { "contextWindow": 262144, "efforts": [], "thinking": true } },

{ "match": { "name": "moonshot-v1-8k.*" }, "metadata": { "contextWindow": 8192 } },
{ "match": { "name": "moonshot-v1-32k.*" }, "metadata": { "contextWindow": 32768 } },
{ "match": { "name": "moonshot-v1-128k.*" }, "metadata": { "contextWindow": 131072 } },
{ "match": { "name": "moonshot-v1-8k-vision-preview.*" }, "metadata": { "contextWindow": 8192 } },
{ "match": { "name": "moonshot-v1-32k-vision-preview.*" }, "metadata": { "contextWindow": 32768 } },
{ "match": { "name": "moonshot-v1-128k-vision-preview.*" }, "metadata": { "contextWindow": 131072 } },

{ "match": { "name": "MiniMax-M2.*" }, "metadata": { "contextWindow": 204800 } },
{ "match": { "name": "MiniMax-M2\\.7.*" }, "metadata": { "contextWindow": 204800 } },
{ "match": { "name": "MiniMax-M2\\.7-highspeed.*" }, "metadata": { "contextWindow": 204800 } },
{ "match": { "name": "MiniMax-M2\\.5.*" }, "metadata": { "contextWindow": 204800 } },
{ "match": { "name": "MiniMax-M2\\.5-highspeed.*" }, "metadata": { "contextWindow": 204800 } },
{ "match": { "name": "MiniMax-M2\\.1.*" }, "metadata": { "contextWindow": 204800 } },
{ "match": { "name": "MiniMax-M2\\.1-highspeed.*" }, "metadata": { "contextWindow": 204800 } },

{ "match": { "name": "deepseek-v4-flash.*" }, "metadata": { "efforts": ["low", "high", "max"], "thinking": true } },
{ "match": { "name": "deepseek-v4-pro.*" }, "metadata": { "efforts": ["low", "high", "max"], "thinking": true } },
{ "match": { "name": "deepseek-flash.*" }, "metadata": { "efforts": ["low", "high", "max"], "thinking": true } },
{ "match": { "name": "deepseek-v4[.-]1-flash.*" },
"metadata": { "efforts": ["low", "high", "max"], "thinking": true } },

{ "match": { "name": "qwen3\\.8-(?:max|flash).*" }, "metadata": { "efforts": ["low", "medium", "xhigh"] } },
{ "match": { "name": "qwen3\\.5-plus.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.5-flash.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3-max.*" }, "metadata": { "contextWindow": 262144 } },
{ "match": { "name": "qwen-plus.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen-flash.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3-vl-plus.*" },
"metadata": { "contextWindow": 262144, "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.7-max.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.7-plus.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.7-flash.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.6-plus.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.6-flash.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "qwen3\\.8-omni-flash.*" },
"metadata": { "contextWindow": 65536, "efforts": ["none", "minimal", "low", "medium", "high", "xhigh", "max"] } },

{ "match": { "name": "mimo-v2\\.6-(?:pro|flash).*" },
"metadata": { "contextWindow": 1000000, "efforts": [], "thinking": true } },
{ "match": { "name": "mimo-v2\\.5.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "mimo-v2\\.5-pro.*" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "mimo-v2-omni.*" }, "metadata": { "contextWindow": 262144 } },
{ "match": { "name": "mimo-v2-flash.*" },
"metadata": { "contextWindow": 262144, "efforts": [], "thinking": true } },

{ "match": { "name": "(?:ox-alpha|glm-x-preview-f|x-preview-f-free).*" },
"metadata": { "efforts": ["low", "high", "max"] } },

{ "match": { "name": "glm-5\\.3" }, "metadata": { "thinking": true } },

{ "match": { "name": "deepseek-v4\\.1-flash" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "deepseek-v4-pro" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "deepseek-v4-flash" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "deepseek-v4-flash-vision-exp" }, "metadata": { "contextWindow": 1000000 } },

{ "match": { "name": "mimo-v2\\.5" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "mimo-v2\\.5-pro" }, "metadata": { "contextWindow": 1048576 } },

{ "match": { "name": "hy4-preview" }, "metadata": { "contextWindow": 1024000, "efforts": ["none", "high"] } },
{ "match": { "name": "hy3" }, "metadata": { "contextWindow": 256000, "efforts": ["none", "low", "high"] } },

{ "match": { "name": "minimax-m3" }, "metadata": { "contextWindow": 1000000, "efforts": [], "thinking": true } },
{ "match": { "name": "minimax-m2\\.7" }, "metadata": { "efforts": [], "thinking": true } },
{ "match": { "name": "minimax-m2\\.5" }, "metadata": { "efforts": [], "thinking": true } },

{ "match": { "name": "qwen3\\.8-max" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "qwen3\\.8-flash" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "qwen3\\.7-max" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "qwen3\\.7-plus" }, "metadata": { "contextWindow": 1000000 } },
{ "match": { "name": "qwen3\\.6-plus" }, "metadata": { "contextWindow": 1000000 } },

{ "match": { "name": "deepseek-v4[.-]1-flash(?:[.\\-:/\\[].*)?" }, "metadata": { "contextWindow": 1048576 } },

{ "match": { "name": "gpt-6\\.1-sol" },
"metadata": { "contextWindow": 1050000, "efforts": ["low", "medium", "high", "xhigh", "max"] } },
{ "match": { "name": "gpt-6\\.1-terra" },
"metadata": { "contextWindow": 1050000, "efforts": ["none", "low", "medium", "high", "xhigh", "max"] } },
{ "match": { "name": "gpt-6-luna" },
"metadata": { "contextWindow": 1050000, "efforts": ["none", "low", "medium", "high", "xhigh", "max"] } },

{ "match": { "name": "claude-haiku-5-5" }, "metadata": { "efforts": ["low", "medium", "high", "xhigh", "max"] } },

{ "match": { "name": "grok-4\\.7" },
"metadata": { "contextWindow": 500000, "efforts": ["low", "medium", "high", "xhigh"] } },

{ "match": { "name": "claude-haiku-5\\.5" }, "metadata": { "efforts": ["low", "medium", "high", "xhigh", "max"] } },

{ "match": { "name": "doubao-seed-evolving" },
"metadata": { "contextWindow": 1024000, "efforts": ["none", "low", "medium", "high"] } },
{ "match": { "name": "doubao-seed-2-1-pro-260915" },
"metadata": { "contextWindow": 1024000, "efforts": ["none", "low", "medium", "high"] } },
{ "match": { "name": "doubao-seed-2-1-lite-260915" },
"metadata": { "contextWindow": 1024000, "efforts": ["none", "low", "medium", "high"] } },
{ "match": { "name": "doubao-seed-2-1-turbo-260628" },
"metadata": { "contextWindow": 256000, "efforts": ["none", "low", "medium", "high"] } },
{ "match": { "name": "doubao-seed-2\\.1-pro" },
"metadata": { "contextWindow": 1024000, "efforts": ["none", "low", "medium", "high"] } },
{ "match": { "name": "doubao-seed-2\\.1-lite" },
"metadata": { "contextWindow": 1024000, "efforts": ["none", "low", "medium", "high"] } },

{ "match": { "name": "step-5-preview" },
"metadata": { "contextWindow": 1000000, "efforts": ["low", "medium", "high"] } },
{ "match": { "name": "step-3\\.7-flash" },
"metadata": { "contextWindow": 262144, "efforts": ["low", "medium", "high"] } },

{ "match": { "name": "kimi-for-coding" },
"metadata": { "contextWindow": 1048576, "efforts": ["low", "high", "max"] } },
{ "match": { "name": "kimi-for-coding-highspeed" },
"metadata": { "contextWindow": 262144, "efforts": [], "thinking": true } },

{ "match": { "name": "MiniMax-M3\\.1-Flash-Preview" },
"metadata": { "contextWindow": 1000000, "efforts": ["low", "medium", "high", "xhigh", "max"] } },
{ "match": { "name": "MiniMax-M3\\.1-Flash" },
"metadata": { "contextWindow": 1000000, "efforts": ["low", "medium", "high", "xhigh", "max"] } }
]
8 changes: 6 additions & 2 deletions app/src/atc/config/Layers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,16 @@ final case class Configuration(
def hiddenEnvironmentVariables: Set[String] = keyVariables ++ keys.names ++ KeyBindings.KnownSecretVariables

/** Every configured model, resolved, with its provider's key. */
def catalog: ModelCatalog = ModelCatalog.from(settings, keys)
def catalog: ModelCatalog = ModelCatalog.from(settings, keys, presets = presets)

/** As [[catalog]], with the providers that configure no models listed by `discover`
* and their lists kept in `store` between sessions. */
def catalog(discover: ModelSpec => List[ModelSpec], store: ModelListStore): ModelCatalog =
ModelCatalog.from(settings, keys, Some(discover), Some(store))
ModelCatalog.from(settings, keys, Some(discover), Some(store), presets)

/** The preset model catalog: the one shipped with the release, with the
* user's own `~/.atc/models.json` layered over it. */
private def presets: ModelPresets = ModelPresets.load(Config.globalDir)

/** Configured child-process environment override pre-approvals from every active layer. */
def environmentRules: List[atc.perms.EnvironmentRule] = layers.flatMap: layer =>
Expand Down
24 changes: 21 additions & 3 deletions app/src/atc/config/ModelCatalog.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ final class ModelCatalog(
/** Every configured provider's name, turned off or not: [[find]] reads a reference that
* starts with one and `/` as naming that provider's model. */
providerNames: Set[String] = Set.empty,
/** Metadata for models whose provider reports none, filled in as a model
* leaves this catalog. Presets are applied here, on the way out, and never
* before `store` keeps a provider's list: a stored list holds only what the
* provider itself said, so a corrected preset takes effect at once instead
* of staying frozen in the cache of an earlier session. */
presets: ModelPresets = ModelPresets.none,
):
private def lower(s: String) = s.toLowerCase(Locale.ROOT)

Expand Down Expand Up @@ -137,7 +143,9 @@ final class ModelCatalog(
available

/** Every model known without waiting: the configured ones, then each provider's newest list. */
private def available: List[ModelSpec] = configured ++ discoverable.flatMap(known(_).getOrElse(Nil))
private def available: List[ModelSpec] =
val all = configured ++ discoverable.flatMap(known(_).getOrElse(Nil))
all.map(presets.apply)

/** The shortest name that identifies `m` on its own. */
def label(m: ModelSpec): String =
Expand All @@ -150,7 +158,9 @@ final class ModelCatalog(
* naming the configured models when it matches none, or both candidates when a name is
* ambiguous. A reference that starts with a provider's name and `/` names a model of that
* provider only, never a listed id of another one. */
def find(reference: String): ModelSpec =
def find(reference: String): ModelSpec = presets(found(reference))

private def found(reference: String): ModelSpec =
val trimmed = reference.trim
val wanted = lower(trimmed)
if wanted.isEmpty then throw IllegalArgumentException("No model given")
Expand Down Expand Up @@ -226,6 +236,7 @@ object ModelCatalog:
keys: KeyBindings = KeyBindings.empty,
discover: Option[ModelSpec => List[ModelSpec]] = None,
store: Option[ModelListStore] = None,
presets: ModelPresets = ModelPresets.builtin,
): ModelCatalog =
val defaults = ModelConfig(webSearch = config.webSearch)
val providers = config.providers.toList.sortBy(_._1).filter(_._2.enabled).map: (name, p) =>
Expand All @@ -245,7 +256,14 @@ object ModelCatalog:
if p.models.isEmpty && !ProviderConfig.canonicalApi(endpoint.api).contains("echo") &&
(endpoint.apiKey.isDefined || (p.key.isEmpty && p.keyEnv.isEmpty)) => endpoint
}
ModelCatalog(configured, discoverable, discover, store, providerNames = config.providers.keySet)
ModelCatalog(
configured,
discoverable,
discover,
store,
providerNames = config.providers.keySet,
presets = presets,
)

/** The provider `name` as an endpoint whose models can be listed, whatever models it
* configures and whether it is on; `None` when its key is not bound. */
Expand Down
Loading
Loading