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
12 changes: 9 additions & 3 deletions crates/adapter-smith/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ pub fn context_window_tokens(provider: &str, model: &str) -> usize {
("meta", "muse-spark-1.1") => 1_000_000,
("meta", _) => 128_000,
("ollama", _) => 8_000,
// xAI Grok models currently expose large context windows on the
// cloud endpoint (order-of-magnitude in the same class as recent
// OpenAI models); this is a safe conservative starting value.
// Grok 4.6 advertises a 500K window on both the API-key and
// subscription paths. Older models keep the conservative cap below.
("grok" | "grok-oauth", "grok-4.6") => 500_000,
("grok", _) => 100_000,
// DeepSeek's V4 line (pro and flash) both advertise a 1M-token
// context window. Without an entry here the `_` arm would cap the
Expand Down Expand Up @@ -402,6 +402,12 @@ mod tests {
);
}

#[test]
fn grok_4_6_gets_its_advertised_context_window_on_both_auth_paths() {
assert_eq!(context_window_tokens("grok", "grok-4.6"), 500_000);
assert_eq!(context_window_tokens("grok-oauth", "grok-4.6"), 500_000);
}

#[test]
fn no_prune_under_budget() {
let mut ms = vec![user("hi"), asst("hello")];
Expand Down
11 changes: 9 additions & 2 deletions crates/daemon/src/availability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ pub async fn smith_auth_methods(
"grok_api_key",
"Grok API key",
"grok",
"grok-2-latest",
"grok-4.6",
&["GROK_API_KEY", "XAI_API_KEY"],
);
let deepseek_key = env_key_method(
Expand Down Expand Up @@ -487,7 +487,7 @@ pub async fn smith_auth_methods(
id: "grok_subscription",
label: "Grok subscription",
model_prefix: "grok-oauth",
default_model: "grok-2-latest",
default_model: "grok-4.6",
available: grok_sub_present,
detail: if grok_sub_present {
"~/.grok/auth.json found".to_string()
Expand Down Expand Up @@ -927,6 +927,13 @@ mod tests {
codex.available,
"fixture ~/.codex/auth.json should be detected"
);
for id in ["grok_api_key", "grok_subscription"] {
let grok = methods
.iter()
.find(|m| m.id == id)
.unwrap_or_else(|| panic!("{id} entry present"));
assert_eq!(grok.default_model, "grok-4.6");
}
let auto = methods
.iter()
.find(|m| m.id == "auto")
Expand Down
12 changes: 6 additions & 6 deletions crates/daemon/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub const CONFIG_TOML_TEMPLATE: &str = r#"# construct configuration template
# # CONSTRUCT_SMITH_MODEL = "claude-oauth:claude-sonnet-4-6" # via Claude subscription
# # CONSTRUCT_SMITH_MODEL = "openai:gpt-5.5" # direct API via OPENAI_API_KEY
# # CONSTRUCT_SMITH_MODEL = "codex-oauth:gpt-5.5" # via OpenAI subscription
# # CONSTRUCT_SMITH_MODEL = "grok-oauth:grok-2-latest" # via Grok subscription
# # CONSTRUCT_SMITH_MODEL = "grok-oauth:grok-4.6" # via Grok subscription
# # CONSTRUCT_SMITH_MODEL = "kimi-oauth:k3" # via Kimi subscription
# # CONSTRUCT_SMITH_MODEL = "gemini:gemini-2.5-pro" # via GEMINI_API_KEY
# # CONSTRUCT_SMITH_MODEL = "meta:muse-spark-1.1" # via META_API_KEY / MODEL_API_KEY
Expand Down Expand Up @@ -230,7 +230,7 @@ enabled = true
# OPENAI_API_KEY -> openai (gpt-5)
# GEMINI_API_KEY / GOOGLE_API_KEY-> gemini (gemini-2.5-pro)
# META_API_KEY / MODEL_API_KEY -> meta (muse-spark-1.1)
# GROK_API_KEY / XAI_API_KEY -> grok (grok-4.5)
# GROK_API_KEY / XAI_API_KEY -> grok (grok-4.6)
# DEEPSEEK_API_KEY -> deepseek (deepseek-v4-pro)
#
# The key must be in the DAEMON's environment (or [daemon.env] below), and a
Expand Down Expand Up @@ -297,7 +297,7 @@ enabled = true
# [smith.models.grok]
# provider = "grok"
# api_key_env = "GROK_API_KEY" # or XAI_API_KEY
# model = "grok-4.3"
# model = "grok-4.6"

# ── Daemon environment ────────────────────────────────────────────────────────
#
Expand Down Expand Up @@ -475,7 +475,7 @@ enabled = true
# # first entry the default.
# claude-oauth = ["opus", "sonnet"]
# codex-oauth = ["gpt-5.6-sol", "gpt-5.5"]
# grok-oauth = "grok-4.5"
# grok-oauth = "grok-4.6"
# kimi-oauth = "k3"
#
"#;
Expand Down Expand Up @@ -734,7 +734,7 @@ pub const BUILTIN_TARGETS: &[BuiltinTarget] = &[
provider: "grok",
base_url: "https://api.x.ai/v1",
key_envs: &["GROK_API_KEY", "XAI_API_KEY"],
default_model: "grok-4.5",
default_model: "grok-4.6",
},
BuiltinTarget {
route: DEEPSEEK_ROUTE_NAME,
Expand Down Expand Up @@ -1013,7 +1013,7 @@ pub struct AdapterConfig {
/// [adapters.smith]
/// env = { CONSTRUCT_SMITH_MODEL = "codex-oauth:gpt-5.5" }
/// # or: env = { CONSTRUCT_SMITH_MODEL = "claude-oauth:sonnet" }
/// # or: env = { CONSTRUCT_SMITH_MODEL = "grok-oauth:grok-2-latest" }
/// # or: env = { CONSTRUCT_SMITH_MODEL = "grok-oauth:grok-4.6" }
/// ```
#[serde(default)]
pub env: HashMap<String, String>,
Expand Down
4 changes: 2 additions & 2 deletions crates/daemon/src/router/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,9 @@ mod tests {
#[test]
fn grok_and_kimi_advertise_their_native_scales() {
let grok = PublishedModel {
id: published_model_id("grok-oauth", "grok-4.5"),
id: published_model_id("grok-oauth", "grok-4.6"),
route: "grok-oauth".into(),
model: "grok-4.5".into(),
model: "grok-4.6".into(),
effort: EffortSupport::Grok,
};
let kimi = PublishedModel {
Expand Down
2 changes: 1 addition & 1 deletion crates/daemon/src/router/oauth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ mod tests {
#[test]
fn effort_support_matches_subscription_model_capabilities() {
assert_eq!(
effort_support(OauthProvider::Grok, "grok-4.5"),
effort_support(OauthProvider::Grok, "grok-4.6"),
super::super::EffortSupport::Grok
);
assert_eq!(
Expand Down
10 changes: 10 additions & 0 deletions crates/protocol/src/slash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,11 @@ pub const MODEL_COMPLETIONS: &[&str] = &[
"ollama:qwen3-coder",
// xAI platform API path. Same models as the OAuth path below, billed
// against an API key instead of a Grok subscription.
"grok:grok-4.6",
"grok:grok-4.5",
"grok:grok-4.3",
// Grok / xAI OAuth path.
"grok-oauth:grok-4.6",
"grok-oauth:grok-4.5",
"grok-oauth:grok-4.3",
"grok-oauth:grok-build-0.1",
Expand Down Expand Up @@ -616,6 +618,14 @@ mod tests {
models_for_provider("meta"),
vec!["muse-spark-1.2", "muse-spark-1.1"]
);
assert_eq!(
models_for_provider("grok"),
vec!["grok-4.6", "grok-4.5", "grok-4.3"]
);
assert_eq!(
models_for_provider("grok-oauth"),
vec!["grok-4.6", "grok-4.5", "grok-4.3", "grok-build-0.1"]
);
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions docs/model-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ A target is somewhere the router can send a model request:
| `OPENAI_API_KEY` | `openai` | `gpt-5` |
| `GEMINI_API_KEY` / `GOOGLE_API_KEY` | `gemini` | `gemini-2.5-pro` |
| `META_API_KEY` / `MODEL_API_KEY` | `meta` | `muse-spark-1.1` |
| `GROK_API_KEY` / `XAI_API_KEY` | `grok` | `grok-4.5` |
| `GROK_API_KEY` / `XAI_API_KEY` | `grok` | `grok-4.6` |
| `DEEPSEEK_API_KEY` | `deepseek` | `deepseek-v4-pro` |

The default model is only the default — the picker offers the rest of that
Expand Down Expand Up @@ -231,7 +231,7 @@ featured_models = [
# a single model; a list becomes the picker's second step.
claude-oauth = ["opus", "sonnet"]
codex-oauth = ["gpt-5.6-sol", "gpt-5.5"]
grok-oauth = "grok-4.5"
grok-oauth = "grok-4.6"
```

## Troubleshooting
Expand Down
8 changes: 4 additions & 4 deletions docs/smith.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export ANTHROPIC_API_KEY=sk-ant-...
# or export DEEPSEEK_API_KEY=...
# or codex login, then use --model codex-oauth:gpt-5.4-mini
# or claude login, then use --model claude-oauth:sonnet
# or grok login, then use --model grok-oauth:grok-4.3
# or grok login, then use --model grok-oauth:grok-4.6
# or kimi login, then use --model kimi-oauth:k3
# or run a local ollama (default http://localhost:11434)

Expand All @@ -37,9 +37,9 @@ The spec is one of:
- `gemini:<name>` — e.g. `gemini:gemini-2.5-pro`
- `meta:<name>` — e.g. `meta:muse-spark-1.1` using `META_API_KEY` or
`MODEL_API_KEY`
- `grok:<name>` — e.g. `grok:grok-4.3` using `GROK_API_KEY` or `XAI_API_KEY`
- `grok:<name>` — e.g. `grok:grok-4.6` using `GROK_API_KEY` or `XAI_API_KEY`
- `deepseek:<name>` — e.g. `deepseek:deepseek-v4-pro` using `DEEPSEEK_API_KEY`
- `grok-oauth:<name>` — e.g. `grok-oauth:grok-4.3` using the Grok CLI auth file
- `grok-oauth:<name>` — e.g. `grok-oauth:grok-4.6` using the Grok CLI auth file
- `kimi-oauth:<name>` — e.g. `kimi-oauth:k3` using the Kimi Code CLI login
- `ollama:<name>` — e.g. `ollama:llama3.1`
- `codex-oauth:<name>` — e.g. `codex-oauth:gpt-5.4-mini`
Expand Down Expand Up @@ -138,7 +138,7 @@ model = "llama-3.3-70b-versatile"
[smith.models.xai]
provider = "grok"
api_key_env = "XAI_API_KEY"
model = "grok-4.3"
model = "grok-4.6"

[smith.models.meta]
provider = "meta"
Expand Down
Loading