code-puppy 0.0.184__py3-none-any.whl → 0.0.185__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,6 +31,12 @@ from .round_robin_model import RoundRobinModel
31
31
  # Example: "X-Api-Key": "$OPENAI_API_KEY" will use the value from os.environ.get("OPENAI_API_KEY")
32
32
 
33
33
 
34
+ class ZaiChatModel(OpenAIChatModel):
35
+ def _process_response(self, response):
36
+ response.object = 'chat.completion'
37
+ return super()._process_response(response)
38
+
39
+
34
40
  def get_custom_config(model_config):
35
41
  custom_config = model_config.get("custom_endpoint", {})
36
42
  if not custom_config:
@@ -51,8 +57,23 @@ def get_custom_config(model_config):
51
57
  f"Please set the environment variable: export {env_var_name}=your_value"
52
58
  )
53
59
  value = resolved_value
60
+ elif "$" in value:
61
+ tokens = value.split(" ")
62
+ resolved_values = []
63
+ for token in tokens:
64
+ if token.startswith("$"):
65
+ env_var = token[1:]
66
+ resolved_value = os.environ.get(env_var)
67
+ if resolved_value is None:
68
+ raise ValueError(
69
+ f"Environment variable '{env_var}' is required for custom endpoint headers but is not set. "
70
+ f"Please set the environment variable: export {env_var}=your_value"
71
+ )
72
+ resolved_values.append(resolved_value)
73
+ else:
74
+ resolved_values.append(token)
75
+ value = " ".join(resolved_values)
54
76
  headers[key] = value
55
-
56
77
  api_key = None
57
78
  if "api_key" in custom_config:
58
79
  if custom_config["api_key"].startswith("$"):
@@ -223,7 +244,24 @@ class ModelFactory:
223
244
  model = OpenAIChatModel(model_name=model_config["name"], provider=provider)
224
245
  setattr(model, "provider", provider)
225
246
  return model
226
-
247
+ elif model_type == "zai_coding":
248
+ zai_model = ZaiChatModel(
249
+ model_name=model_config["name"],
250
+ provider=OpenAIProvider(
251
+ api_key=os.getenv('ZAI_API_KEY'),
252
+ base_url='https://api.z.ai/api/coding/paas/v4'
253
+ )
254
+ )
255
+ return zai_model
256
+ elif model_type == "zai_api":
257
+ zai_model = ZaiChatModel(
258
+ model_name=model_config["name"],
259
+ provider=OpenAIProvider(
260
+ api_key=os.getenv('ZAI_API_KEY'),
261
+ base_url='https://api.z.ai/api/paas/v4/'
262
+ )
263
+ )
264
+ return zai_model
227
265
  elif model_type == "custom_gemini":
228
266
  url, headers, verify, api_key = get_custom_config(model_config)
229
267
  os.environ["GEMINI_API_KEY"] = api_key
code_puppy/models.json CHANGED
@@ -45,84 +45,27 @@
45
45
  "name": "claude-sonnet-4-20250514",
46
46
  "context_length": 200000
47
47
  },
48
- "o3": {
49
- "type": "openai",
50
- "name": "o3",
48
+ "claude-4-5-sonnet": {
49
+ "type": "anthropic",
50
+ "name": "claude-sonnet-4-5-20250929",
51
51
  "context_length": 200000
52
52
  },
53
- "grok-4": {
54
- "type": "custom_openai",
55
- "name": "grok-4",
56
- "custom_endpoint": {
57
- "url": "https://api.x.ai/v1",
58
- "api_key": "$XAI_API_KEY"
59
- },
60
- "context_length": 256000
61
- },
62
- "grok-code-fast-1": {
63
- "type": "custom_openai",
64
- "name": "grok-code-fast-1",
65
- "custom_endpoint": {
66
- "url": "https://api.x.ai/v1",
67
- "api_key": "$XAI_API_KEY"
68
- },
69
- "context_length": 256000
70
- },
71
- "gemini-2.5-flash-preview-05-20": {
72
- "type": "gemini",
73
- "name": "gemini-2.5-flash-preview-05-20",
74
- "context_length": 1048576
75
- },
76
- "gpt-4.1": {
77
- "type": "openai",
78
- "name": "gpt-4.1",
79
- "context_length": 1000000
80
- },
81
- "Qwen/Qwen3-235B-A22B-fp8-tput": {
82
- "type": "custom_openai",
83
- "name": "Qwen/Qwen3-235B-A22B-fp8-tput",
84
- "custom_endpoint": {
85
- "url": "https://api.together.xyz/v1",
86
- "api_key": "$TOGETHER_API_KEY"
87
- },
88
- "context_length": 64000
89
- },
90
- "azure-gpt-4.1": {
91
- "type": "azure_openai",
92
- "name": "gpt-4.1",
93
- "api_version": "2024-12-01-preview",
94
- "api_key": "$AZURE_OPENAI_API_KEY",
95
- "azure_endpoint": "$AZURE_OPENAI_ENDPOINT",
96
- "context_length": 128000
53
+ "glm-4.5-coding": {
54
+ "type": "zai_coding",
55
+ "name": "glm-4.5"
97
56
  },
98
- "gpt-4.1-mini": {
99
- "type": "openai",
100
- "name": "gpt-4.1-mini",
101
- "context_length": 128000
102
- },
103
- "gpt-4.1-nano": {
104
- "type": "openai",
105
- "name": "gpt-4.1-nano",
106
- "context_length": 128000
57
+ "glm-4.6-coding": {
58
+ "type": "zai_coding",
59
+ "name": "glm-4.6",
60
+ "context_length": 200000
107
61
  },
108
- "gpt-4.1-custom": {
109
- "type": "custom_openai",
110
- "name": "gpt-4.1-custom",
111
- "custom_endpoint": {
112
- "url": "https://my.cute.endpoint:8080",
113
- "headers": {
114
- "X-Api-Key": "$OPENAI_API_KEY"
115
- },
116
- "ca_certs_path": "/path/to/cert.pem"
117
- },
118
- "context_length": 128000
62
+ "glm-4.5": {
63
+ "type": "zai_api",
64
+ "name": "glm-4.5"
119
65
  },
120
- "ollama-llama3.3": {
121
- "type": "custom_openai",
122
- "name": "llama3.3",
123
- "custom_endpoint": {
124
- "url": "http://localhost:11434/v1"
125
- },
126
- "context_length": 8192
66
+ "glm-4.6": {
67
+ "type": "zai_api",
68
+ "name": "glm-4.6",
69
+ "context_length": 200000
127
70
  }
128
71
  }
@@ -0,0 +1,71 @@
1
+ {
2
+ "gpt-5": {
3
+ "type": "openai",
4
+ "name": "gpt-5",
5
+ "context_length": 400000
6
+ },
7
+ "Cerebras-Qwen3-Coder-480b": {
8
+ "type": "cerebras",
9
+ "name": "qwen-3-coder-480b",
10
+ "custom_endpoint": {
11
+ "url": "https://api.cerebras.ai/v1",
12
+ "api_key": "$CEREBRAS_API_KEY"
13
+ },
14
+ "context_length": 131072
15
+ },
16
+ "Cerebras-Qwen3-235b-a22b-instruct-2507": {
17
+ "type": "cerebras",
18
+ "name": "qwen-3-235b-a22b-instruct-2507",
19
+ "custom_endpoint": {
20
+ "url": "https://api.cerebras.ai/v1",
21
+ "api_key": "$CEREBRAS_API_KEY"
22
+ },
23
+ "context_length": 64000
24
+ },
25
+ "Cerebras-gpt-oss-120b": {
26
+ "type": "cerebras",
27
+ "name": "gpt-oss-120b",
28
+ "custom_endpoint": {
29
+ "url": "https://api.cerebras.ai/v1",
30
+ "api_key": "$CEREBRAS_API_KEY"
31
+ },
32
+ "context_length": 131072
33
+ },
34
+ "Cerebras-Qwen-3-32b": {
35
+ "type": "cerebras",
36
+ "name": "qwen-3-32b",
37
+ "custom_endpoint": {
38
+ "url": "https://api.cerebras.ai/v1",
39
+ "api_key": "$CEREBRAS_API_KEY"
40
+ },
41
+ "context_length": 65536
42
+ },
43
+ "claude-4-0-sonnet": {
44
+ "type": "anthropic",
45
+ "name": "claude-sonnet-4-20250514",
46
+ "context_length": 200000
47
+ },
48
+ "claude-4-5-sonnet": {
49
+ "type": "anthropic",
50
+ "name": "claude-sonnet-4-5-20250929",
51
+ "context_length": 200000
52
+ },
53
+ "glm-4.5-coding": {
54
+ "type": "zai_coding",
55
+ "name": "glm-4.5"
56
+ },
57
+ "glm-4.6-coding": {
58
+ "type": "zai_coding",
59
+ "name": "glm-4.6",
60
+ "context_length": 200000
61
+ },
62
+ "glm-4.5": {
63
+ "type": "zai_api",
64
+ "name": "glm-4.5"
65
+ },
66
+ "glm-4.6": {
67
+ "type": "zai_api",
68
+ "name": "glm-4.6",
69
+ "context_length": 200000
70
+ }
71
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-puppy
3
- Version: 0.0.184
3
+ Version: 0.0.185
4
4
  Summary: Code generation agent
5
5
  Project-URL: repository, https://github.com/mpfaffenberger/code_puppy
6
6
  Project-URL: HomePage, https://github.com/mpfaffenberger/code_puppy
@@ -4,8 +4,8 @@ code_puppy/callbacks.py,sha256=6wYB6K_fGSCkKKEFaYOYkJT45WaV5W_NhUIzcvVH_nU,5060
4
4
  code_puppy/config.py,sha256=smjGUs18VJQxPeVLvV8U2T_YuGh7E_Sg5ZgaXhdBWWg,20677
5
5
  code_puppy/http_utils.py,sha256=YLd8Y16idbI32JGeBXG8n5rT4o4X_zxk9FgUvK9XFo8,8248
6
6
  code_puppy/main.py,sha256=_TvwZFFepyq6UCC29ApFUeXeODsRHV2OyFuzM3xkiwo,20601
7
- code_puppy/model_factory.py,sha256=KLyxUrZJual6uo_TncjdPhdDbvIvHiztWvK9bfdQmmc,13759
8
- code_puppy/models.json,sha256=iXmLZGflnQcu2DRh4WUlgAhoXdvoxUc7KBhB8YxawXM,3088
7
+ code_puppy/model_factory.py,sha256=qI10PM27SOdgeeJk_ncWDEKtWealCRyJLLmxedLpH2s,15410
8
+ code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
9
9
  code_puppy/reopenable_async_client.py,sha256=4UJRaMp5np8cbef9F0zKQ7TPKOfyf5U-Kv-0zYUWDho,8274
10
10
  code_puppy/round_robin_model.py,sha256=UEfw-Ix7GpNRWSxxuJtA-EE4_A46KXjMgFRciprfLmg,5634
11
11
  code_puppy/status_display.py,sha256=F6eEAkGePDp4StM2BWj-uLLQTDGtJrf0IufzCeP1rRg,8336
@@ -119,9 +119,9 @@ code_puppy/tui/screens/help.py,sha256=eJuPaOOCp7ZSUlecearqsuX6caxWv7NQszUh0tZJjB
119
119
  code_puppy/tui/screens/mcp_install_wizard.py,sha256=vObpQwLbXjQsxmSg-WCasoev1usEi0pollKnL0SHu9U,27693
120
120
  code_puppy/tui/screens/settings.py,sha256=-WLldnKyWVKUYVPJcfOn1UU6eP9t8lLPUAVI317SOOM,10685
121
121
  code_puppy/tui/screens/tools.py,sha256=3pr2Xkpa9Js6Yhf1A3_wQVRzFOui-KDB82LwrsdBtyk,1715
122
- code_puppy-0.0.184.data/data/code_puppy/models.json,sha256=iXmLZGflnQcu2DRh4WUlgAhoXdvoxUc7KBhB8YxawXM,3088
123
- code_puppy-0.0.184.dist-info/METADATA,sha256=ZkHxBwyThIm0dxsILQI4NS_KiDOeKOwYFhR-cjCbSTE,20079
124
- code_puppy-0.0.184.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
125
- code_puppy-0.0.184.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
126
- code_puppy-0.0.184.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
127
- code_puppy-0.0.184.dist-info/RECORD,,
122
+ code_puppy-0.0.185.data/data/code_puppy/models.json,sha256=dClUciCo2RlVDs0ZAQCIur8MOavZUEAXHEecn0uPa-4,1629
123
+ code_puppy-0.0.185.dist-info/METADATA,sha256=4zywOEFYUOzKlhpfdMyf6yAFCiqgC17VcZpi-X6LfJc,20079
124
+ code_puppy-0.0.185.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
125
+ code_puppy-0.0.185.dist-info/entry_points.txt,sha256=Tp4eQC99WY3HOKd3sdvb22vZODRq0XkZVNpXOag_KdI,91
126
+ code_puppy-0.0.185.dist-info/licenses/LICENSE,sha256=31u8x0SPgdOq3izJX41kgFazWsM43zPEF9eskzqbJMY,1075
127
+ code_puppy-0.0.185.dist-info/RECORD,,
@@ -1,128 +0,0 @@
1
- {
2
- "gpt-5": {
3
- "type": "openai",
4
- "name": "gpt-5",
5
- "context_length": 400000
6
- },
7
- "Cerebras-Qwen3-Coder-480b": {
8
- "type": "cerebras",
9
- "name": "qwen-3-coder-480b",
10
- "custom_endpoint": {
11
- "url": "https://api.cerebras.ai/v1",
12
- "api_key": "$CEREBRAS_API_KEY"
13
- },
14
- "context_length": 131072
15
- },
16
- "Cerebras-Qwen3-235b-a22b-instruct-2507": {
17
- "type": "cerebras",
18
- "name": "qwen-3-235b-a22b-instruct-2507",
19
- "custom_endpoint": {
20
- "url": "https://api.cerebras.ai/v1",
21
- "api_key": "$CEREBRAS_API_KEY"
22
- },
23
- "context_length": 64000
24
- },
25
- "Cerebras-gpt-oss-120b": {
26
- "type": "cerebras",
27
- "name": "gpt-oss-120b",
28
- "custom_endpoint": {
29
- "url": "https://api.cerebras.ai/v1",
30
- "api_key": "$CEREBRAS_API_KEY"
31
- },
32
- "context_length": 131072
33
- },
34
- "Cerebras-Qwen-3-32b": {
35
- "type": "cerebras",
36
- "name": "qwen-3-32b",
37
- "custom_endpoint": {
38
- "url": "https://api.cerebras.ai/v1",
39
- "api_key": "$CEREBRAS_API_KEY"
40
- },
41
- "context_length": 65536
42
- },
43
- "claude-4-0-sonnet": {
44
- "type": "anthropic",
45
- "name": "claude-sonnet-4-20250514",
46
- "context_length": 200000
47
- },
48
- "o3": {
49
- "type": "openai",
50
- "name": "o3",
51
- "context_length": 200000
52
- },
53
- "grok-4": {
54
- "type": "custom_openai",
55
- "name": "grok-4",
56
- "custom_endpoint": {
57
- "url": "https://api.x.ai/v1",
58
- "api_key": "$XAI_API_KEY"
59
- },
60
- "context_length": 256000
61
- },
62
- "grok-code-fast-1": {
63
- "type": "custom_openai",
64
- "name": "grok-code-fast-1",
65
- "custom_endpoint": {
66
- "url": "https://api.x.ai/v1",
67
- "api_key": "$XAI_API_KEY"
68
- },
69
- "context_length": 256000
70
- },
71
- "gemini-2.5-flash-preview-05-20": {
72
- "type": "gemini",
73
- "name": "gemini-2.5-flash-preview-05-20",
74
- "context_length": 1048576
75
- },
76
- "gpt-4.1": {
77
- "type": "openai",
78
- "name": "gpt-4.1",
79
- "context_length": 1000000
80
- },
81
- "Qwen/Qwen3-235B-A22B-fp8-tput": {
82
- "type": "custom_openai",
83
- "name": "Qwen/Qwen3-235B-A22B-fp8-tput",
84
- "custom_endpoint": {
85
- "url": "https://api.together.xyz/v1",
86
- "api_key": "$TOGETHER_API_KEY"
87
- },
88
- "context_length": 64000
89
- },
90
- "azure-gpt-4.1": {
91
- "type": "azure_openai",
92
- "name": "gpt-4.1",
93
- "api_version": "2024-12-01-preview",
94
- "api_key": "$AZURE_OPENAI_API_KEY",
95
- "azure_endpoint": "$AZURE_OPENAI_ENDPOINT",
96
- "context_length": 128000
97
- },
98
- "gpt-4.1-mini": {
99
- "type": "openai",
100
- "name": "gpt-4.1-mini",
101
- "context_length": 128000
102
- },
103
- "gpt-4.1-nano": {
104
- "type": "openai",
105
- "name": "gpt-4.1-nano",
106
- "context_length": 128000
107
- },
108
- "gpt-4.1-custom": {
109
- "type": "custom_openai",
110
- "name": "gpt-4.1-custom",
111
- "custom_endpoint": {
112
- "url": "https://my.cute.endpoint:8080",
113
- "headers": {
114
- "X-Api-Key": "$OPENAI_API_KEY"
115
- },
116
- "ca_certs_path": "/path/to/cert.pem"
117
- },
118
- "context_length": 128000
119
- },
120
- "ollama-llama3.3": {
121
- "type": "custom_openai",
122
- "name": "llama3.3",
123
- "custom_endpoint": {
124
- "url": "http://localhost:11434/v1"
125
- },
126
- "context_length": 8192
127
- }
128
- }