zephyrcode 1.0.0__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.
zephyrcode/__init__.py ADDED
@@ -0,0 +1,189 @@
1
+ """
2
+ ZephyrCode Python SDK
3
+ =====================
4
+ The official Python SDK for the ZephyrCode AI coding agent.
5
+
6
+ Install:
7
+ pip install zephyrcode
8
+
9
+ Quick start:
10
+ from zephyrcode import ZephyrCode
11
+
12
+ client = ZephyrCode(api_key="zeph_your_api_key_here")
13
+
14
+ response = client.chat.create(
15
+ messages=[{"role": "user", "content": "Build a React counter"}],
16
+ model="z-code-ultra",
17
+ mode="code",
18
+ )
19
+ print(response.content)
20
+
21
+ Author: ZephyrCode Labs
22
+ License: MIT
23
+ """
24
+
25
+ import json
26
+ import requests
27
+ from typing import List, Dict, Optional, Any
28
+
29
+ __version__ = "1.0.0"
30
+ __author__ = "ZephyrCode Labs"
31
+ __email__ = "support@zephyrcode.ai"
32
+
33
+ BASE_URL = "https://zephyrcode.space-z.ai"
34
+
35
+
36
+ class ZephyrCodeError(Exception):
37
+ """Base exception for ZephyrCode SDK errors."""
38
+ pass
39
+
40
+
41
+ class ZephyrCode:
42
+ """
43
+ ZephyrCode AI coding agent client.
44
+
45
+ Args:
46
+ api_key: Your ZephyrCode API key (starts with 'zeph_').
47
+ base_url: Override the base URL (defaults to https://zephyrcode.space-z.ai).
48
+ """
49
+
50
+ def __init__(self, api_key: str, base_url: str = BASE_URL):
51
+ self.api_key = api_key
52
+ self.base_url = base_url.rstrip("/")
53
+ self.chat = Chat(self)
54
+
55
+ def _request(self, method: str, path: str, data: Optional[Dict] = None) -> Dict:
56
+ url = f"{self.base_url}{path}"
57
+ headers = {
58
+ "Content-Type": "application/json",
59
+ "Authorization": f"Bearer {self.api_key}",
60
+ }
61
+ resp = requests.request(method, url, headers=headers, json=data, timeout=120)
62
+
63
+ if resp.status_code == 401:
64
+ raise ZephyrCodeError("Invalid API key. Check your key at https://zephyrcode.space-z.ai/apikey")
65
+ if resp.status_code == 429:
66
+ raise ZephyrCodeError("Rate limit exceeded. Upgrade your plan for higher limits.")
67
+ if resp.status_code >= 500:
68
+ raise ZephyrCodeError(f"Server error: {resp.status_code}")
69
+
70
+ return resp.json()
71
+
72
+ def tts(self, text: str, voice: str = "adam", speed: float = 1.0) -> bytes:
73
+ """
74
+ Generate speech from text using ZephyrCode's TTS engine.
75
+
76
+ Args:
77
+ text: The text to convert to speech (max 4000 chars).
78
+ voice: Voice ID (e.g. 'adam', 'rachel', 'hindi-priya').
79
+ speed: Speech speed (0.5 - 2.0).
80
+
81
+ Returns:
82
+ WAV audio bytes.
83
+ """
84
+ url = f"{self.base_url}/api/tts"
85
+ headers = {
86
+ "Content-Type": "application/json",
87
+ "Authorization": f"Bearer {self.api_key}",
88
+ }
89
+ resp = requests.post(url, headers=headers, json={
90
+ "text": text, "voice": voice, "speed": speed
91
+ }, timeout=60)
92
+
93
+ if resp.status_code != 200:
94
+ raise ZephyrCodeError(f"TTS failed: {resp.status_code}")
95
+
96
+ return resp.content
97
+
98
+
99
+ class Chat:
100
+ """Chat / agent endpoint accessor."""
101
+
102
+ def __init__(self, client: ZephyrCode):
103
+ self.client = client
104
+
105
+ def create(
106
+ self,
107
+ messages: List[Dict[str, str]],
108
+ model: str = "z-code-ultra",
109
+ mode: str = "code",
110
+ thinking: bool = True,
111
+ ) -> "ChatResponse":
112
+ """
113
+ Send a chat request to the ZephyrCode AI agent.
114
+
115
+ Args:
116
+ messages: List of message dicts with 'role' and 'content'.
117
+ model: Model ID ('z-code-ultra', 'z-code-pro', 'z-code-edge').
118
+ mode: Agent mode ('code', 'agentic', 'appbuilder', 'websitebuilder',
119
+ 'teamwork', 'architect', 'debug', 'review', 'explain').
120
+ thinking: Enable extended thinking/reasoning.
121
+
122
+ Returns:
123
+ ChatResponse object with .content, .reasoning, .tool_calls, .plan.
124
+ """
125
+ data = self.client._request("POST", "/api/agent", {
126
+ "messages": messages,
127
+ "model": model,
128
+ "mode": mode,
129
+ "thinking": thinking,
130
+ })
131
+ return ChatResponse(data)
132
+
133
+
134
+ class ChatResponse:
135
+ """
136
+ Response from the ZephyrCode AI agent.
137
+
138
+ Attributes:
139
+ content: The main text response (markdown).
140
+ reasoning: List of reasoning steps (if thinking was enabled).
141
+ tool_calls: List of tool calls the agent made.
142
+ plan: The execution plan (if generated).
143
+ model: The model used.
144
+ mode: The agent mode used.
145
+ fallback_used: Whether a fallback was used (LLM was unavailable).
146
+ """
147
+
148
+ def __init__(self, data: Dict[str, Any]):
149
+ self.content: str = data.get("content", "")
150
+ self.reasoning: List = data.get("reasoning", [])
151
+ self.tool_calls: List = data.get("tool_calls", [])
152
+ self.plan: Optional[Dict] = data.get("plan")
153
+ self.model: str = data.get("model", "")
154
+ self.mode: str = data.get("mode", "")
155
+ self.fallback_used: bool = data.get("fallback_used", False)
156
+
157
+ def __str__(self) -> str:
158
+ return self.content
159
+
160
+ def __repr__(self) -> str:
161
+ return f"ChatResponse(model='{self.model}', mode='{self.mode}', content_length={len(self.content)})"
162
+
163
+
164
+ # Convenience function for quick one-shot calls
165
+ def generate(
166
+ prompt: str,
167
+ api_key: str,
168
+ model: str = "z-code-ultra",
169
+ mode: str = "code",
170
+ ) -> str:
171
+ """
172
+ Quick one-shot code generation.
173
+
174
+ Args:
175
+ prompt: Your coding request.
176
+ api_key: Your ZephyrCode API key.
177
+ model: Model to use.
178
+ mode: Agent mode.
179
+
180
+ Returns:
181
+ The generated text content.
182
+ """
183
+ client = ZephyrCode(api_key=api_key)
184
+ response = client.chat.create(
185
+ messages=[{"role": "user", "content": prompt}],
186
+ model=model,
187
+ mode=mode,
188
+ )
189
+ return response.content
@@ -0,0 +1,6 @@
1
+ """ZephyrCode Python SDK — Official AI coding agent SDK."""
2
+
3
+ __version__ = "1.0.0"
4
+ __author__ = "ZephyrCode Labs"
5
+ __email__ = "support@zephyrcode.ai"
6
+ __all__ = ["ZephyrCode", "ZephyrCodeError", "ChatResponse", "generate"]
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.4
2
+ Name: zephyrcode
3
+ Version: 1.0.0
4
+ Summary: Official ZephyrCode AI coding agent SDK — generate code, use TTS, and build with AI.
5
+ Author-email: ZephyrCode Labs <support@zephyrcode.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://zephyrcode.space-z.ai
8
+ Project-URL: Documentation, https://zephyrcode.space-z.ai/apikey
9
+ Project-URL: Repository, https://github.com/zephyrcode/zephyrcode-python
10
+ Project-URL: Bug Tracker, https://github.com/zephyrcode/zephyrcode-python/issues
11
+ Keywords: AI,coding agent,code generator,AI code,TTS,text-to-speech,voice cloning,API,SDK,zephyrcode,z-code,GitHub Copilot alternative,Cursor alternative
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Code Generators
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests>=2.28.0
29
+ Dynamic: license-file
30
+
31
+ # ZephyrCode Python SDK
32
+
33
+ The official Python SDK for the ZephyrCode AI coding agent.
34
+
35
+ ## Install
36
+
37
+ ```bash
38
+ pip install zephyrcode
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ from zephyrcode import ZephyrCode
45
+
46
+ client = ZephyrCode(api_key="zeph_your_api_key_here")
47
+
48
+ response = client.chat.create(
49
+ messages=[
50
+ {"role": "user", "content": "Build a React counter component"}
51
+ ],
52
+ model="z-code-ultra",
53
+ mode="code",
54
+ )
55
+
56
+ print(response.content)
57
+ ```
58
+
59
+ ## Text-to-Speech
60
+
61
+ ```python
62
+ client = ZephyrCode(api_key="zeph_your_api_key_here")
63
+
64
+ audio_bytes = client.tts(
65
+ text="Hello world!",
66
+ voice="adam",
67
+ speed=1.0,
68
+ )
69
+
70
+ with open("output.wav", "wb") as f:
71
+ f.write(audio_bytes)
72
+ ```
73
+
74
+ ## Agent Modes
75
+
76
+ - `code` — Write, edit, and refactor production code
77
+ - `agentic` — Autonomous multi-step engineering
78
+ - `appbuilder` — Build full-stack apps from a single prompt
79
+ - `websitebuilder` — Generate complete websites
80
+ - `teamwork` — Collaborate with team members
81
+ - `architect` — Design systems and evaluate tradeoffs
82
+ - `debug` — Root-cause failures and propose fixes
83
+ - `review` — Review diffs for style, security, and performance
84
+ - `explain` — Explain code, concepts, and tradeoffs
85
+
86
+ ## Models
87
+
88
+ - `z-code-ultra` — Frontier model (2M context)
89
+ - `z-code-pro` — Balanced model (256K context)
90
+ - `z-code-edge` — Lightweight on-device model (32K context)
91
+
92
+ ## License
93
+
94
+ MIT
@@ -0,0 +1,7 @@
1
+ zephyrcode/__init__.py,sha256=d8Fyc1C4Cd42Ihq_3-JnzcbKHe1W2DBzq-kSwnAGfbI,5631
2
+ zephyrcode/__version__.py,sha256=yPxwvdzKFtYoez2qJtBxe75E_1cVGwAN6XydDTkTzbk,224
3
+ zephyrcode-1.0.0.dist-info/licenses/LICENSE,sha256=bX7yFZS6TmYf0BIpwvrPB8huZ_FNKcs0DlJY8woUABc,1072
4
+ zephyrcode-1.0.0.dist-info/METADATA,sha256=EAIslj47hYXX6ul78D2SZi0hOlGOrqbu90N-2b2jO-I,2836
5
+ zephyrcode-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ zephyrcode-1.0.0.dist-info/top_level.txt,sha256=wi_kd0ow8EQgbQ9xawzgjCJsBDTPbTktrvnyYSaDpco,11
7
+ zephyrcode-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZephyrCode Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ zephyrcode