mirror of
https://github.com/block/goose.git
synced 2026-07-09 16:09:22 +00:00
feat: add iFlytek Spark and Astron MaaS providers (#9837)
Signed-off-by: FenjuFu <fufenjupku@gmail.com> Co-authored-by: Douwe M Osinga <douwe@sidewalklabs.com>
This commit is contained in:
parent
452ea10123
commit
04da8e8702
4 changed files with 90 additions and 0 deletions
|
|
@ -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");
|
||||
|
|
|
|||
22
crates/goose/src/providers/declarative/iflytek.json
Normal file
22
crates/goose/src/providers/declarative/iflytek.json
Normal file
|
|
@ -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},
|
||||
{"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
crates/goose/src/providers/declarative/iflytek_astron.json
Normal file
41
crates/goose/src/providers/declarative/iflytek_astron.json
Normal file
|
|
@ -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},
|
||||
{"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"
|
||||
]
|
||||
}
|
||||
|
|
@ -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` |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue