@ailib-official/ai-protocol 0.8.4 → 1.0.0

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.
Files changed (47) hide show
  1. package/README.md +10 -2
  2. package/dist/v1/models/deepseek-chat.json +4 -4
  3. package/dist/v1/models/gemini.json +59 -1
  4. package/dist/v1/providers/gemini.json +11 -1
  5. package/dist/v2/contracts/anthropic-messages.contract.json +62 -0
  6. package/dist/v2/contracts/gemini-generate.contract.json +59 -0
  7. package/dist/v2/providers/anthropic.json +42 -10
  8. package/dist/v2/providers/cohere.json +21 -0
  9. package/dist/v2/providers/deepseek.json +121 -47
  10. package/dist/v2/providers/doubao.json +23 -8
  11. package/dist/v2/providers/google.json +39 -0
  12. package/dist/v2/providers/groq.json +223 -0
  13. package/dist/v2/providers/jina.json +15 -0
  14. package/dist/v2/providers/moonshot.json +23 -8
  15. package/dist/v2/providers/nvidia.json +520 -0
  16. package/dist/v2/providers/openai.json +39 -11
  17. package/dist/v2/providers/qwen.json +25 -9
  18. package/dist/v2/providers/zhipu.json +114 -22
  19. package/package.json +12 -3
  20. package/schemas/v1.json +1 -1
  21. package/schemas/v2/availability.json +12 -0
  22. package/schemas/v2/capabilities.json +4 -0
  23. package/schemas/v2/error-codes.yaml +5 -0
  24. package/schemas/v2/metadata-model-entry.json +57 -0
  25. package/schemas/v2/pack.json +145 -0
  26. package/schemas/v2/provider-contract.json +45 -0
  27. package/schemas/v2/provider.json +15 -2
  28. package/schemas/v2/tool-calling.json +61 -0
  29. package/v1/models/deepseek-chat.yaml +4 -4
  30. package/v1/models/gemini.yaml +31 -1
  31. package/v1/providers/gemini.yaml +10 -2
  32. package/v2/contracts/anthropic-messages.contract.yaml +55 -0
  33. package/v2/contracts/gemini-generate.contract.yaml +52 -0
  34. package/v2/packs/examples/README.md +9 -0
  35. package/v2/packs/examples/deepseek-economy-pack.json +43 -0
  36. package/v2/providers/anthropic.yaml +34 -13
  37. package/v2/providers/cohere.yaml +16 -3
  38. package/v2/providers/deepseek.yaml +77 -33
  39. package/v2/providers/doubao.yaml +18 -8
  40. package/v2/providers/google.yaml +32 -4
  41. package/v2/providers/groq.yaml +159 -0
  42. package/v2/providers/jina.yaml +10 -0
  43. package/v2/providers/moonshot.yaml +20 -12
  44. package/v2/providers/nvidia.yaml +405 -0
  45. package/v2/providers/openai.yaml +33 -11
  46. package/v2/providers/qwen.yaml +20 -9
  47. package/v2/providers/zhipu.yaml +70 -23
@@ -29,6 +29,21 @@
29
29
  "503": "overloaded"
30
30
  }
31
31
  },
32
+ "availability": {
33
+ "required": false,
34
+ "regions": [
35
+ "cn"
36
+ ],
37
+ "check": {
38
+ "method": "GET",
39
+ "path": "/models",
40
+ "expected_status": [
41
+ 200,
42
+ 401
43
+ ],
44
+ "timeout_ms": 3000
45
+ }
46
+ },
32
47
  "capabilities": {
33
48
  "required": [
34
49
  "text",
@@ -51,6 +66,14 @@
51
66
  "streaming_usage": true,
52
67
  "system_messages": true,
53
68
  "image_generation": true
69
+ },
70
+ "tool_calling": {
71
+ "native": {
72
+ "supported": true,
73
+ "reliability": "full",
74
+ "parallel": true,
75
+ "streaming": true
76
+ }
54
77
  }
55
78
  },
56
79
  "capability_profile": {
@@ -101,14 +124,6 @@
101
124
  "type": "boolean"
102
125
  }
103
126
  },
104
- "parameter_mappings": {
105
- "temperature": "temperature",
106
- "max_tokens": "max_tokens",
107
- "stream": "stream",
108
- "top_p": "top_p",
109
- "tools": "tools",
110
- "tool_choice": "tool_choice"
111
- },
112
127
  "streaming": {
113
128
  "decoder": {
114
129
  "format": "sse",
@@ -39,6 +39,21 @@
39
39
  "DEADLINE_EXCEEDED": "timeout"
40
40
  }
41
41
  },
42
+ "availability": {
43
+ "required": false,
44
+ "regions": [
45
+ "global"
46
+ ],
47
+ "check": {
48
+ "method": "GET",
49
+ "path": "/models",
50
+ "expected_status": [
51
+ 200,
52
+ 401
53
+ ],
54
+ "timeout_ms": 3000
55
+ }
56
+ },
42
57
  "capabilities": {
43
58
  "required": [
44
59
  "text",
@@ -62,6 +77,14 @@
62
77
  "extended_thinking": true,
63
78
  "streaming_usage": false,
64
79
  "system_messages": true
80
+ },
81
+ "tool_calling": {
82
+ "native": {
83
+ "supported": true,
84
+ "reliability": "full",
85
+ "parallel": true,
86
+ "streaming": true
87
+ }
65
88
  }
66
89
  },
67
90
  "capability_profile": {
@@ -373,6 +396,22 @@
373
396
  "input_per_1m": 0.15,
374
397
  "output_per_1m": 0.6
375
398
  }
399
+ },
400
+ "gemini-2.5-flash-lite": {
401
+ "context_window": 1048576,
402
+ "max_output_tokens": 65536
403
+ },
404
+ "gemini-2.5-flash": {
405
+ "context_window": 1048576,
406
+ "max_output_tokens": 65536
407
+ },
408
+ "gemini-2.5-pro": {
409
+ "context_window": 2097152,
410
+ "max_output_tokens": 65536
411
+ },
412
+ "gemini-3.1-flash-lite-preview": {
413
+ "context_window": 1048576,
414
+ "max_output_tokens": 65536
376
415
  }
377
416
  },
378
417
  "context_caching": {
@@ -0,0 +1,223 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v2/provider.json",
3
+ "id": "groq",
4
+ "protocol_version": "2.0",
5
+ "name": "Groq",
6
+ "version": "1.0.0",
7
+ "status": "stable",
8
+ "category": "ai_provider",
9
+ "official_url": "https://console.groq.com/docs",
10
+ "support_contact": "https://support.groq.com",
11
+ "endpoint": {
12
+ "base_url": "https://api.groq.com/openai/v1",
13
+ "chat": "/chat/completions",
14
+ "auth": {
15
+ "type": "bearer",
16
+ "header": "Authorization",
17
+ "prefix": "Bearer",
18
+ "token_env": "GROQ_API_KEY"
19
+ }
20
+ },
21
+ "error_classification": {
22
+ "by_http_status": {
23
+ "400": "invalid_request",
24
+ "401": "authentication",
25
+ "403": "permission_denied",
26
+ "404": "not_found",
27
+ "429": "rate_limited",
28
+ "500": "server_error",
29
+ "503": "overloaded"
30
+ },
31
+ "by_error_code": {
32
+ "context_length_exceeded": "request_too_large",
33
+ "model_not_found": "not_found",
34
+ "rate_limit_exceeded": "rate_limited"
35
+ }
36
+ },
37
+ "availability": {
38
+ "required": false,
39
+ "regions": [
40
+ "global"
41
+ ],
42
+ "check": {
43
+ "method": "GET",
44
+ "path": "/models",
45
+ "expected_status": [
46
+ 200,
47
+ 401
48
+ ],
49
+ "timeout_ms": 3000
50
+ }
51
+ },
52
+ "capabilities": {
53
+ "required": [
54
+ "text",
55
+ "streaming",
56
+ "tools"
57
+ ],
58
+ "optional": [
59
+ "parallel_tools",
60
+ "agentic"
61
+ ],
62
+ "feature_flags": {
63
+ "parallel_tool_calls": true,
64
+ "streaming_usage": true,
65
+ "system_messages": true
66
+ },
67
+ "tool_calling": {
68
+ "native": {
69
+ "supported": true,
70
+ "reliability": "full",
71
+ "parallel": true
72
+ }
73
+ }
74
+ },
75
+ "parameters": {
76
+ "temperature": {
77
+ "type": "float",
78
+ "range": [
79
+ 0,
80
+ 2
81
+ ],
82
+ "default": 1
83
+ },
84
+ "max_tokens": {
85
+ "type": "integer",
86
+ "min": 1,
87
+ "max": 8192
88
+ },
89
+ "top_p": {
90
+ "type": "float",
91
+ "range": [
92
+ 0,
93
+ 1
94
+ ]
95
+ },
96
+ "stream": {
97
+ "type": "boolean"
98
+ }
99
+ },
100
+ "streaming": {
101
+ "decoder": {
102
+ "format": "sse",
103
+ "strategy": "openai_chat",
104
+ "done_signal": "[DONE]",
105
+ "prefix": "data: "
106
+ },
107
+ "content_path": "$.choices[0].delta.content",
108
+ "tool_call_path": "$.choices[0].delta.tool_calls",
109
+ "usage_path": "$.usage",
110
+ "event_map": [
111
+ {
112
+ "match": "exists($.choices[*].delta.content)",
113
+ "emit": "PartialContentDelta",
114
+ "fields": {
115
+ "content": "$.choices[*].delta.content"
116
+ }
117
+ },
118
+ {
119
+ "match": "exists($.choices[*].delta.tool_calls)",
120
+ "emit": "PartialToolCall",
121
+ "fields": {
122
+ "tool_calls": "$.choices[*].delta.tool_calls"
123
+ }
124
+ },
125
+ {
126
+ "match": "exists($.usage)",
127
+ "emit": "Metadata",
128
+ "fields": {
129
+ "usage": "$.usage"
130
+ }
131
+ },
132
+ {
133
+ "match": "$.choices[*].finish_reason != null",
134
+ "emit": "StreamEnd",
135
+ "fields": {
136
+ "finish_reason": "$.choices[*].finish_reason"
137
+ }
138
+ }
139
+ ],
140
+ "stop_condition": "$.choices[0].finish_reason != null"
141
+ },
142
+ "multimodal": {
143
+ "input": {
144
+ "vision": {
145
+ "supported": false
146
+ },
147
+ "audio": {
148
+ "supported": false
149
+ },
150
+ "video": {
151
+ "supported": false
152
+ }
153
+ },
154
+ "output": {
155
+ "text": true,
156
+ "audio": {
157
+ "supported": false
158
+ },
159
+ "image": {
160
+ "supported": false
161
+ }
162
+ }
163
+ },
164
+ "api_families": [
165
+ "chat_completions"
166
+ ],
167
+ "default_api_family": "chat_completions",
168
+ "endpoints": {
169
+ "chat": {
170
+ "path": "/chat/completions",
171
+ "method": "POST",
172
+ "adapter": "openai"
173
+ }
174
+ },
175
+ "services": {
176
+ "list_models": {
177
+ "path": "/models",
178
+ "method": "GET",
179
+ "response_binding": "data"
180
+ }
181
+ },
182
+ "retry_policy": {
183
+ "strategy": "exponential_backoff",
184
+ "max_retries": 3,
185
+ "min_delay_ms": 1000,
186
+ "max_delay_ms": 30000,
187
+ "jitter": "full",
188
+ "retry_on_http_status": [
189
+ 429,
190
+ 500,
191
+ 502,
192
+ 503
193
+ ]
194
+ },
195
+ "termination": {
196
+ "source_field": "finish_reason",
197
+ "mapping": {
198
+ "stop": "end_turn",
199
+ "length": "max_tokens",
200
+ "tool_calls": "tool_use"
201
+ }
202
+ },
203
+ "metadata": {
204
+ "api_compatibility": "openai",
205
+ "models": {
206
+ "llama-3.1-8b-instant": {
207
+ "context_window": 128000,
208
+ "max_output_tokens": 8192,
209
+ "verification": {
210
+ "status": "verified",
211
+ "source": "official_documentation",
212
+ "verified_at": "2026-05-29",
213
+ "notes": "https://console.groq.com/docs/models"
214
+ }
215
+ }
216
+ },
217
+ "sdk": {
218
+ "note": "OpenAI-compatible — use openai SDK with base_url override",
219
+ "python": "openai",
220
+ "typescript": "openai"
221
+ }
222
+ }
223
+ }
@@ -28,6 +28,21 @@
28
28
  "500": "server_error"
29
29
  }
30
30
  },
31
+ "availability": {
32
+ "required": false,
33
+ "regions": [
34
+ "global"
35
+ ],
36
+ "check": {
37
+ "method": "GET",
38
+ "path": "/v1/models",
39
+ "expected_status": [
40
+ 200,
41
+ 401
42
+ ],
43
+ "timeout_ms": 3000
44
+ }
45
+ },
31
46
  "capabilities": {
32
47
  "required": [
33
48
  "rerank"
@@ -35,6 +35,21 @@
35
35
  "insufficient_quota": "quota_exhausted"
36
36
  }
37
37
  },
38
+ "availability": {
39
+ "required": false,
40
+ "regions": [
41
+ "cn"
42
+ ],
43
+ "check": {
44
+ "method": "GET",
45
+ "path": "/models",
46
+ "expected_status": [
47
+ 200,
48
+ 401
49
+ ],
50
+ "timeout_ms": 3000
51
+ }
52
+ },
38
53
  "capabilities": {
39
54
  "required": [
40
55
  "text",
@@ -54,6 +69,14 @@
54
69
  "parallel_tool_calls": true,
55
70
  "streaming_usage": true,
56
71
  "system_messages": true
72
+ },
73
+ "tool_calling": {
74
+ "native": {
75
+ "supported": true,
76
+ "reliability": "full",
77
+ "parallel": true,
78
+ "streaming": true
79
+ }
57
80
  }
58
81
  },
59
82
  "capability_profile": {
@@ -104,14 +127,6 @@
104
127
  "type": "boolean"
105
128
  }
106
129
  },
107
- "parameter_mappings": {
108
- "temperature": "temperature",
109
- "max_tokens": "max_tokens",
110
- "stream": "stream",
111
- "top_p": "top_p",
112
- "tools": "tools",
113
- "tool_choice": "tool_choice"
114
- },
115
130
  "streaming": {
116
131
  "decoder": {
117
132
  "format": "sse",