(feat): add routstr as a declarative provider (#9175)
Signed-off-by: 9qeklajc <9qeklajc> Co-authored-by: 9qeklajc <9qeklajc>
This commit is contained in:
@@ -878,4 +878,31 @@ mod tests {
|
||||
let result = expand_env_vars("${TEST_EXPAND_OVERRIDE}/path", &env_vars).unwrap();
|
||||
assert_eq!(result, "https://from-env.com/path");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_routstr_json_deserializes() {
|
||||
let json = include_str!("../providers/declarative/routstr.json");
|
||||
let config: DeclarativeProviderConfig =
|
||||
serde_json::from_str(json).expect("routstr.json should parse");
|
||||
assert_eq!(config.name, "routstr");
|
||||
assert_eq!(config.display_name, "Routstr");
|
||||
assert!(matches!(config.engine, ProviderEngine::OpenAI));
|
||||
assert_eq!(config.api_key_env, "ROUTSTR_API_KEY");
|
||||
assert_eq!(config.base_url, "${ROUTSTR_HOST}/v1");
|
||||
assert_eq!(config.dynamic_models, Some(true));
|
||||
assert_eq!(config.supports_streaming, Some(true));
|
||||
assert!(config.skip_canonical_filtering);
|
||||
assert_eq!(config.models.len(), 6);
|
||||
|
||||
let env_vars = config.env_vars.as_ref().expect("env_vars should be set");
|
||||
assert_eq!(env_vars.len(), 1);
|
||||
assert_eq!(env_vars[0].name, "ROUTSTR_HOST");
|
||||
assert!(!env_vars[0].required);
|
||||
assert!(!env_vars[0].secret);
|
||||
assert_eq!(env_vars[0].primary, Some(true));
|
||||
assert_eq!(
|
||||
env_vars[0].default,
|
||||
Some("https://api.routstr.com".to_string())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "routstr",
|
||||
"engine": "openai",
|
||||
"display_name": "Routstr",
|
||||
"description": "OpenAI-compatible aggregator that fronts dozens of upstream providers (OpenAI, Anthropic, Google, DeepSeek, Llama, …) behind a single API. Authenticate with an sk-... bearer issued by a Routstr instance — payment (e.g. Cashu top-up) is handled outside goose.",
|
||||
"api_key_env": "ROUTSTR_API_KEY",
|
||||
"base_url": "${ROUTSTR_HOST}/v1",
|
||||
"env_vars": [
|
||||
{
|
||||
"name": "ROUTSTR_HOST",
|
||||
"required": false,
|
||||
"secret": false,
|
||||
"primary": true,
|
||||
"default": "https://api.routstr.com",
|
||||
"description": "Base URL of the Routstr proxy (default: https://api.routstr.com)"
|
||||
}
|
||||
],
|
||||
"dynamic_models": true,
|
||||
"models": [
|
||||
{ "name": "claude-opus-4.7", "context_limit": 1000000 },
|
||||
{ "name": "gemini-3.1-pro-preview", "context_limit": 1048576 },
|
||||
{ "name": "gemini-3-flash-preview", "context_limit": 1048576 },
|
||||
{ "name": "deepseek-v4-pro", "context_limit": 1048576 },
|
||||
{ "name": "glm-5.1", "context_limit": 202752 },
|
||||
{ "name": "minimax-m2.7", "context_limit": 196608 }
|
||||
],
|
||||
"supports_streaming": true,
|
||||
"skip_canonical_filtering": true,
|
||||
"model_doc_link": "https://routstr.com/docs",
|
||||
"setup_steps": [
|
||||
"Pick a Routstr instance (e.g. https://api.routstr.com) and obtain an sk-... API key from its payment flow.",
|
||||
"Paste the key above as ROUTSTR_API_KEY.",
|
||||
"Optionally override ROUTSTR_HOST to point at a different Routstr proxy."
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user