Skip to content

Your lightweight open-source personal agent.

test(config): cover LM Studio nullable api key

Xubin Ren2b8e90d8fd96
diff --git a/tests/cli/test_commands.py b/tests/cli/test_commands.py
index e4edfaf87..a21991959 100644
--- a/tests/cli/test_commands.py
+++ b/tests/cli/test_commands.py
@@ -257,6 +257,28 @@ def test_config_accepts_camel_case_explicit_provider_name_for_coding_plan():
assert config.get_api_base() == "https://ark.cn-beijing.volces.com/api/coding/v3"
+def test_config_accepts_lm_studio_without_api_key_and_uses_default_localhost_api_base():
+ config = Config.model_validate(
+ {
+ "agents": {
+ "defaults": {
+ "provider": "lm_studio",
+ "model": "local-model",
+ }
+ },
+ "providers": {
+ "lmStudio": {
+ "apiKey": None,
+ }
+ },
+ }
+ )
+
+ assert config.get_provider_name() == "lm_studio"
+ assert config.get_api_key() is None
+ assert config.get_api_base() == "http://localhost:1234/v1"
+
+
def test_find_by_name_accepts_camel_case_and_hyphen_aliases():
assert find_by_name("volcengineCodingPlan") is not None
assert find_by_name("volcengineCodingPlan").name == "volcengine_coding_plan"