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
25 changes: 25 additions & 0 deletions crates/goose/src/config/declarative_providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,31 @@ mod tests {
);
}

#[test]
fn test_all_bundled_providers_deserialize() {
// `load_fixed_providers` silently skips any bundled JSON that fails to
// deserialize (it only emits a `warn!`), so a malformed provider file would
// ship as a missing provider rather than a build/test failure. Assert every
// bundled file parses through the same path the loader uses.
let mut failures = Vec::new();
for file in FIXED_PROVIDERS.files() {
if file.path().extension().and_then(|s| s.to_str()) != Some("json") {
continue;
}
let content = file
.contents_utf8()
.unwrap_or_else(|| panic!("bundled provider {:?} is not valid UTF-8", file.path()));
if let Err(e) = deserialize_provider_config(content) {
failures.push(format!("{:?}: {e}", file.path()));
}
}
assert!(
failures.is_empty(),
"bundled declarative providers failed to deserialize:\n{}",
failures.join("\n")
);
}

#[test]
fn test_existing_json_files_still_deserialize_without_new_fields() {
let json = include_str!("../providers/declarative/groq.json");
Expand Down
22 changes: 22 additions & 0 deletions crates/goose/src/providers/declarative/iflytek.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "iflytek",
"engine": "openai",
"display_name": "iFlytek Spark",
"description": "iFlytek Spark (讯飞星火) models via the OpenAI-compatible HTTP API. Authenticate with your Spark HTTP API password (APIPassword). Lists the 4.0Ultra and Max families, which per the Spark HTTP docs accept system messages (always sent by goose). Best used for chat: Spark only returns OpenAI-style tool_calls when the request body sets tool_calls_switch=true, which this declarative config cannot inject, so tool-using extensions may not work as-is.",
"api_key_env": "SPARK_API_PASSWORD",
"base_url": "https://spark-api-open.xf-yun.com/v1",
"dynamic_models": false,
"skip_canonical_filtering": true,
"models": [
{"name": "4.0Ultra", "context_limit": 8192},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Raise Spark Ultra's context limit

For 4.0Ultra, the Spark HTTP docs list Ultra's maximum input length as 32K (https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html), but this config advertises only 8192. ProviderEntry::normalize_model_config backfills ModelConfig.context_limit from these JSON ModelInfo entries, so 4.0Ultra sessions will compact and drop context around 8K even though the provider accepts much more; please set this entry to the documented window.

Useful? React with 👍 / 👎.

{"name": "generalv3.5", "context_limit": 8192},
{"name": "max-32k", "context_limit": 32768}
],
"supports_streaming": true,
"model_doc_link": "https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html",
"setup_steps": [
"Sign in to https://xinghuo.xfyun.cn/sparkapi and create or select a Spark model plan",
"Open the model's 'HTTP 服务接口认证信息' page and copy the APIPassword (each model version has its own password)",
"Paste the APIPassword above as SPARK_API_PASSWORD"
]
}
41 changes: 41 additions & 0 deletions crates/goose/src/providers/declarative/iflytek_astron.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "iflytek_astron",
"engine": "openai",
"display_name": "iFlytek Astron MaaS",
"description": "iFlytek Astron MaaS (讯飞星辰) models via the OpenAI-compatible API. Defaults to the Token Plan endpoint; set ASTRON_BASE_URL to https://maas-coding-api.cn-huabei-1.xf-yun.com/v2 to use the Coding Plan (e.g. astron-code-latest). Each plan has its own API key.",
"api_key_env": "ASTRON_API_KEY",
"base_url": "${ASTRON_BASE_URL}",
"env_vars": [
{
"name": "ASTRON_BASE_URL",
"required": false,
"secret": false,
"default": "https://maas-token-api.cn-huabei-1.xf-yun.com/v2",
"description": "Astron MaaS API base URL. Use https://maas-coding-api.cn-huabei-1.xf-yun.com/v2 for Coding Plan models like astron-code-latest."
}
],
"dynamic_models": false,
"skip_canonical_filtering": true,
"models": [
{"name": "xsparkx2", "context_limit": 131072},
{"name": "xsparkx2flash", "context_limit": 131072},
{"name": "xopglm51", "context_limit": 204800},
{"name": "xopglm5", "context_limit": 204800},
{"name": "xopdeepseekv4pro", "context_limit": 131072},
{"name": "xopdeepseekv4flash", "context_limit": 131072},
Comment on lines +24 to +25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Raise Astron V4 context limits

The Astron Token Plan model table documents DeepSeek-V4-Pro and DeepSeek-V4-Flash with 1M context windows (https://www.xfyun.cn/doc/spark/TokenPlan.html), but both entries here are capped at 131072. Because these static limits are copied into the session model config before compaction decisions, users of either V4 model will unnecessarily lose most of the usable context instead of running near the provider's advertised 1M window.

Useful? React with 👍 / 👎.

{"name": "xopdeepseekv32", "context_limit": 131072},
{"name": "xopkimik26", "context_limit": 262144},
{"name": "xminimaxm25", "context_limit": 131072},
{"name": "xopqwen35397b", "context_limit": 262144},
{"name": "astron-code-latest", "context_limit": 131072}
],
"supports_streaming": true,
"preserves_thinking": true,
"model_doc_link": "https://www.xfyun.cn/doc/spark/TokenPlan.html",
"setup_steps": [
"Sign in to https://maas.xfyun.cn and subscribe to a Token Plan (general models) or Coding Plan (astron-code-latest)",
"Copy the dedicated API Key for your plan from the subscription page",
"Paste the API Key above as ASTRON_API_KEY",
"For Coding Plan, set ASTRON_BASE_URL to https://maas-coding-api.cn-huabei-1.xf-yun.com/v2"
]
}
2 changes: 2 additions & 0 deletions documentation/docs/getting-started/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ goose is compatible with a wide range of LLM providers, allowing you to choose a
| [GCP Vertex AI](https://cloud.google.com/vertex-ai) | Google Cloud's Vertex AI platform, supporting Gemini and Claude models. **Credentials must be [configured in advance](https://cloud.google.com/vertex-ai/docs/authentication).** Filters for allowed models by organization policy (if configured). | `GCP_PROJECT_ID`, `GCP_LOCATION` and optionally `GCP_MAX_RATE_LIMIT_RETRIES` (5), `GCP_MAX_OVERLOADED_RETRIES` (5), `GCP_INITIAL_RETRY_INTERVAL_MS` (5000), `GCP_BACKOFF_MULTIPLIER` (2.0), `GCP_MAX_RETRY_INTERVAL_MS` (320_000). |
| [GitHub Copilot](https://docs.github.com/en/copilot/using-github-copilot/ai-models) | Access to AI models from OpenAI, Anthropic, Google, and other providers through GitHub's Copilot infrastructure. **GitHub account with Copilot access required.** | No manual key. Uses [device flow authentication](#github-copilot-authentication) for both CLI and Desktop. |
| [Groq](https://groq.com/) | High-performance inference hardware and tools for LLMs. | `GROQ_API_KEY` |
| [iFlytek Spark](https://www.xfyun.cn/doc/spark/HTTP%E8%B0%83%E7%94%A8%E6%96%87%E6%A1%A3.html) | iFlytek Spark (讯飞星火) models (4.0Ultra, generalv3.5, max-32k) via the OpenAI-compatible HTTP API. Best for chat: Spark needs `tool_calls_switch=true` (not injectable here) to return OpenAI-style tool calls. | `SPARK_API_PASSWORD` |
| [iFlytek Astron MaaS](https://maas.xfyun.cn/) | iFlytek Astron MaaS (讯飞星辰) hosting Spark X2, DeepSeek, GLM, Kimi, MiniMax, Qwen, and Astron coding models via an OpenAI-compatible API. Set `ASTRON_BASE_URL` to switch between the Token Plan and Coding Plan endpoints. | `ASTRON_API_KEY`, `ASTRON_BASE_URL` (optional) |
| [LiteLLM](https://docs.litellm.ai/docs/) | LiteLLM proxy supporting multiple models with automatic prompt caching and unified API access. | `LITELLM_HOST`, `LITELLM_BASE_PATH` (optional), `LITELLM_API_KEY` (optional), `LITELLM_CUSTOM_HEADERS` (optional), `LITELLM_TIMEOUT` (optional) |
| [LM Studio](https://lmstudio.ai/) | Run local models with LM Studio's OpenAI-compatible server. **Because this provider runs locally, you must first [download a model](#local-llms).** | None required. Connects to local server at `localhost:1234` by default. |
| [Mistral AI](https://mistral.ai/) | Provides access to Mistral models including general-purpose models, specialized coding models (Codestral), and multimodal models (Pixtral). | `MISTRAL_API_KEY` |
Expand Down
Loading