@apicity/zaicoding 0.6.3 → 0.6.5
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.
- package/README.md +20 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](package.json)
|
|
5
5
|
[](tsconfig.json)
|
|
6
6
|
|
|
7
|
-
Z.ai GLM Coding Plan provider for Apicity — OpenAI-compatible chat completions plus coding-plan usage
|
|
7
|
+
Z.ai GLM Coding Plan provider for Apicity — standalone, OpenAI-compatible chat completions plus coding-plan usage/quota monitoring.
|
|
8
8
|
|
|
9
9
|
Runtime dependencies:
|
|
10
10
|
|
|
@@ -23,48 +23,41 @@ pnpm add @apicity/zaicoding
|
|
|
23
23
|
```typescript
|
|
24
24
|
import { createZaiCoding } from "@apicity/zaicoding";
|
|
25
25
|
|
|
26
|
-
const zaicoding = createZaiCoding({
|
|
27
|
-
apiKey: process.env.ZAI_CODING_PLAN_API_KEY!,
|
|
28
|
-
});
|
|
26
|
+
const zaicoding = createZaiCoding({ apiKey: process.env.ZAI_CODING_PLAN_API_KEY! });
|
|
29
27
|
```
|
|
30
28
|
|
|
31
29
|
## API Reference
|
|
32
30
|
|
|
33
31
|
4 endpoints across 2 groups. Each method mirrors an upstream URL path.
|
|
34
32
|
|
|
35
|
-
###
|
|
33
|
+
### coding
|
|
36
34
|
|
|
37
35
|
<details>
|
|
38
|
-
<summary><code>POST</code> <b><code>zaicoding.
|
|
36
|
+
<summary><code>POST</code> <b><code>zaicoding.api.coding.paas.v4.chat.completions</code></b></summary>
|
|
39
37
|
|
|
40
38
|
<code>POST https://api.z.ai/api/coding/paas/v4/chat/completions</code>
|
|
41
39
|
|
|
42
40
|
[Upstream docs ↗](https://docs.z.ai/api-reference/llm/chat-completion)
|
|
43
41
|
|
|
44
42
|
```typescript
|
|
45
|
-
const res = await zaicoding.
|
|
46
|
-
model: "glm-4-flash",
|
|
47
|
-
messages: [{ role: "user", content: "Say hello." }],
|
|
48
|
-
});
|
|
49
|
-
console.log(res.choices[0].message.content);
|
|
43
|
+
const res = await zaicoding.api.coding.paas.v4.chat.completions({ /* ... */ });
|
|
50
44
|
```
|
|
51
45
|
|
|
52
46
|
Source: [`packages/provider/zaicoding/src/zaicoding.ts`](src/zaicoding.ts)
|
|
53
47
|
|
|
54
48
|
</details>
|
|
55
49
|
|
|
56
|
-
###
|
|
50
|
+
### monitor
|
|
57
51
|
|
|
58
52
|
<details>
|
|
59
|
-
<summary><code>GET</code> <b><code>zaicoding.
|
|
53
|
+
<summary><code>GET</code> <b><code>zaicoding.api.monitor.usage.modelUsage</code></b></summary>
|
|
60
54
|
|
|
61
|
-
<code>GET https://api.z.ai/api/monitor/usage/
|
|
55
|
+
<code>GET https://api.z.ai/api/monitor/usage/model-usage</code>
|
|
62
56
|
|
|
63
57
|
[Upstream docs ↗](https://docs.z.ai/api-reference/introduction)
|
|
64
58
|
|
|
65
59
|
```typescript
|
|
66
|
-
const res = await zaicoding.
|
|
67
|
-
console.log(res.data?.level, res.data?.limits);
|
|
60
|
+
const res = await zaicoding.api.monitor.usage.modelUsage({ /* ... */ });
|
|
68
61
|
```
|
|
69
62
|
|
|
70
63
|
Source: [`packages/provider/zaicoding/src/zaicoding.ts`](src/zaicoding.ts)
|
|
@@ -72,15 +65,14 @@ Source: [`packages/provider/zaicoding/src/zaicoding.ts`](src/zaicoding.ts)
|
|
|
72
65
|
</details>
|
|
73
66
|
|
|
74
67
|
<details>
|
|
75
|
-
<summary><code>GET</code> <b><code>zaicoding.
|
|
68
|
+
<summary><code>GET</code> <b><code>zaicoding.api.monitor.usage.quota.limit</code></b></summary>
|
|
76
69
|
|
|
77
|
-
<code>GET https://api.z.ai/api/monitor/usage/
|
|
70
|
+
<code>GET https://api.z.ai/api/monitor/usage/quota/limit</code>
|
|
78
71
|
|
|
79
72
|
[Upstream docs ↗](https://docs.z.ai/api-reference/introduction)
|
|
80
73
|
|
|
81
74
|
```typescript
|
|
82
|
-
const res = await zaicoding.
|
|
83
|
-
console.log(res.data?.totalUsage);
|
|
75
|
+
const res = await zaicoding.api.monitor.usage.quota.limit({ /* ... */ });
|
|
84
76
|
```
|
|
85
77
|
|
|
86
78
|
Source: [`packages/provider/zaicoding/src/zaicoding.ts`](src/zaicoding.ts)
|
|
@@ -88,17 +80,22 @@ Source: [`packages/provider/zaicoding/src/zaicoding.ts`](src/zaicoding.ts)
|
|
|
88
80
|
</details>
|
|
89
81
|
|
|
90
82
|
<details>
|
|
91
|
-
<summary><code>GET</code> <b><code>zaicoding.
|
|
83
|
+
<summary><code>GET</code> <b><code>zaicoding.api.monitor.usage.toolUsage</code></b></summary>
|
|
92
84
|
|
|
93
85
|
<code>GET https://api.z.ai/api/monitor/usage/tool-usage</code>
|
|
94
86
|
|
|
95
87
|
[Upstream docs ↗](https://docs.z.ai/api-reference/introduction)
|
|
96
88
|
|
|
97
89
|
```typescript
|
|
98
|
-
const res = await zaicoding.
|
|
99
|
-
console.log(res.data?.totalUsage);
|
|
90
|
+
const res = await zaicoding.api.monitor.usage.toolUsage({ /* ... */ });
|
|
100
91
|
```
|
|
101
92
|
|
|
102
93
|
Source: [`packages/provider/zaicoding/src/zaicoding.ts`](src/zaicoding.ts)
|
|
103
94
|
|
|
104
95
|
</details>
|
|
96
|
+
|
|
97
|
+
Part of the [apicity](https://github.com/justintanner/apicity) monorepo.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
MIT — see [LICENSE](LICENSE).
|
package/package.json
CHANGED