@ailib-official/ai-protocol 0.8.4

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 (194) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +415 -0
  3. package/dist/index.json +8 -0
  4. package/dist/v1/models/ai21.json +140 -0
  5. package/dist/v1/models/baichuan.json +138 -0
  6. package/dist/v1/models/cerebras.json +147 -0
  7. package/dist/v1/models/claude.json +114 -0
  8. package/dist/v1/models/cohere.json +235 -0
  9. package/dist/v1/models/deepinfra.json +43 -0
  10. package/dist/v1/models/deepseek-chat.json +55 -0
  11. package/dist/v1/models/doubao.json +197 -0
  12. package/dist/v1/models/ernie.json +223 -0
  13. package/dist/v1/models/fireworks.json +222 -0
  14. package/dist/v1/models/gemini.json +58 -0
  15. package/dist/v1/models/gpt.json +166 -0
  16. package/dist/v1/models/grok.json +138 -0
  17. package/dist/v1/models/huggingface.json +183 -0
  18. package/dist/v1/models/hunyuan.json +255 -0
  19. package/dist/v1/models/jina.json +139 -0
  20. package/dist/v1/models/lepton.json +188 -0
  21. package/dist/v1/models/llama.json +143 -0
  22. package/dist/v1/models/minimax.json +194 -0
  23. package/dist/v1/models/mistral.json +177 -0
  24. package/dist/v1/models/moonshot.json +144 -0
  25. package/dist/v1/models/nvidia.json +212 -0
  26. package/dist/v1/models/palmyra.json +103 -0
  27. package/dist/v1/models/perplexity.json +143 -0
  28. package/dist/v1/models/qwen.json +49 -0
  29. package/dist/v1/models/replicate.json +206 -0
  30. package/dist/v1/models/sensenova.json +144 -0
  31. package/dist/v1/models/siliconflow.json +44 -0
  32. package/dist/v1/models/spark.json +173 -0
  33. package/dist/v1/models/stable-diffusion.json +161 -0
  34. package/dist/v1/models/tiangong.json +169 -0
  35. package/dist/v1/models/together.json +43 -0
  36. package/dist/v1/models/yi.json +199 -0
  37. package/dist/v1/models/zhipu.json +250 -0
  38. package/dist/v1/providers/ai21.json +215 -0
  39. package/dist/v1/providers/anthropic.json +253 -0
  40. package/dist/v1/providers/anyscale.json +115 -0
  41. package/dist/v1/providers/azure.json +188 -0
  42. package/dist/v1/providers/baichuan.json +205 -0
  43. package/dist/v1/providers/baidu.json +205 -0
  44. package/dist/v1/providers/cerebras.json +216 -0
  45. package/dist/v1/providers/cohere.json +209 -0
  46. package/dist/v1/providers/deepinfra.json +196 -0
  47. package/dist/v1/providers/deepseek.json +221 -0
  48. package/dist/v1/providers/doubao.json +209 -0
  49. package/dist/v1/providers/fireworks.json +227 -0
  50. package/dist/v1/providers/gemini.json +279 -0
  51. package/dist/v1/providers/groq.json +218 -0
  52. package/dist/v1/providers/huggingface.json +181 -0
  53. package/dist/v1/providers/hunyuan.json +198 -0
  54. package/dist/v1/providers/jina.json +202 -0
  55. package/dist/v1/providers/lepton.json +221 -0
  56. package/dist/v1/providers/minimax.json +209 -0
  57. package/dist/v1/providers/mistral.json +214 -0
  58. package/dist/v1/providers/moonshot.json +214 -0
  59. package/dist/v1/providers/nvidia.json +213 -0
  60. package/dist/v1/providers/openai.json +267 -0
  61. package/dist/v1/providers/openrouter.json +220 -0
  62. package/dist/v1/providers/perplexity.json +172 -0
  63. package/dist/v1/providers/qwen.json +231 -0
  64. package/dist/v1/providers/replicate.json +192 -0
  65. package/dist/v1/providers/sensenova.json +185 -0
  66. package/dist/v1/providers/siliconflow.json +197 -0
  67. package/dist/v1/providers/spark.json +204 -0
  68. package/dist/v1/providers/stability.json +221 -0
  69. package/dist/v1/providers/tiangong.json +207 -0
  70. package/dist/v1/providers/together.json +196 -0
  71. package/dist/v1/providers/writer.json +253 -0
  72. package/dist/v1/providers/xai.json +238 -0
  73. package/dist/v1/providers/yi.json +205 -0
  74. package/dist/v1/providers/zhipu.json +208 -0
  75. package/dist/v1/spec.json +783 -0
  76. package/dist/v2/providers/anthropic.json +372 -0
  77. package/dist/v2/providers/cohere.json +109 -0
  78. package/dist/v2/providers/deepseek.json +272 -0
  79. package/dist/v2/providers/doubao.json +260 -0
  80. package/dist/v2/providers/google.json +388 -0
  81. package/dist/v2/providers/jina.json +71 -0
  82. package/dist/v2/providers/moonshot.json +284 -0
  83. package/dist/v2/providers/openai.json +419 -0
  84. package/dist/v2/providers/qwen.json +274 -0
  85. package/dist/v2/providers/zhipu.json +257 -0
  86. package/dist/v2-alpha/providers/anthropic.json +182 -0
  87. package/dist/v2-alpha/providers/gemini.json +187 -0
  88. package/dist/v2-alpha/providers/openai.json +215 -0
  89. package/dist/v2-alpha/spec.json +644 -0
  90. package/package.json +61 -0
  91. package/schemas/spec.json +186 -0
  92. package/schemas/v1.json +1116 -0
  93. package/schemas/v2/availability.json +66 -0
  94. package/schemas/v2/capabilities.json +182 -0
  95. package/schemas/v2/capability-profile.json +174 -0
  96. package/schemas/v2/computer-use.json +222 -0
  97. package/schemas/v2/context-policy.json +148 -0
  98. package/schemas/v2/endpoint.json +2 -0
  99. package/schemas/v2/error-codes.yaml +225 -0
  100. package/schemas/v2/errors.json +250 -0
  101. package/schemas/v2/execution-metadata.json +59 -0
  102. package/schemas/v2/mcp.json +225 -0
  103. package/schemas/v2/message-roles.json +10 -0
  104. package/schemas/v2/multimodal.json +297 -0
  105. package/schemas/v2/pricing.json +14 -0
  106. package/schemas/v2/provider-contract.json +317 -0
  107. package/schemas/v2/provider.json +203 -0
  108. package/schemas/v2/regions.json +14 -0
  109. package/v1/models/ai21.yaml +97 -0
  110. package/v1/models/baichuan.yaml +95 -0
  111. package/v1/models/cerebras.yaml +99 -0
  112. package/v1/models/claude.yaml +59 -0
  113. package/v1/models/cohere.yaml +165 -0
  114. package/v1/models/deepinfra.yaml +29 -0
  115. package/v1/models/deepseek-chat.yaml +32 -0
  116. package/v1/models/doubao.yaml +129 -0
  117. package/v1/models/ernie.yaml +146 -0
  118. package/v1/models/fireworks.yaml +145 -0
  119. package/v1/models/gemini.yaml +32 -0
  120. package/v1/models/gpt.yaml +90 -0
  121. package/v1/models/grok.yaml +74 -0
  122. package/v1/models/huggingface.yaml +110 -0
  123. package/v1/models/hunyuan.yaml +164 -0
  124. package/v1/models/jina.yaml +98 -0
  125. package/v1/models/lepton.yaml +130 -0
  126. package/v1/models/llama.yaml +91 -0
  127. package/v1/models/minimax.yaml +132 -0
  128. package/v1/models/mistral.yaml +100 -0
  129. package/v1/models/moonshot.yaml +97 -0
  130. package/v1/models/nvidia.yaml +118 -0
  131. package/v1/models/palmyra.yaml +59 -0
  132. package/v1/models/perplexity.yaml +97 -0
  133. package/v1/models/qwen.yaml +27 -0
  134. package/v1/models/replicate.yaml +136 -0
  135. package/v1/models/sensenova.yaml +97 -0
  136. package/v1/models/siliconflow.yaml +29 -0
  137. package/v1/models/spark.yaml +114 -0
  138. package/v1/models/stable-diffusion.yaml +113 -0
  139. package/v1/models/tiangong.yaml +114 -0
  140. package/v1/models/together.yaml +29 -0
  141. package/v1/models/yi.yaml +132 -0
  142. package/v1/models/zhipu.yaml +163 -0
  143. package/v1/providers/ai21.yaml +176 -0
  144. package/v1/providers/anthropic.yaml +209 -0
  145. package/v1/providers/anyscale.yaml +106 -0
  146. package/v1/providers/azure.yaml +155 -0
  147. package/v1/providers/baichuan.yaml +168 -0
  148. package/v1/providers/baidu.yaml +173 -0
  149. package/v1/providers/cerebras.yaml +178 -0
  150. package/v1/providers/cohere.yaml +175 -0
  151. package/v1/providers/deepinfra.yaml +156 -0
  152. package/v1/providers/deepseek.yaml +189 -0
  153. package/v1/providers/doubao.yaml +172 -0
  154. package/v1/providers/fireworks.yaml +187 -0
  155. package/v1/providers/gemini.yaml +229 -0
  156. package/v1/providers/groq.yaml +181 -0
  157. package/v1/providers/huggingface.yaml +157 -0
  158. package/v1/providers/hunyuan.yaml +162 -0
  159. package/v1/providers/jina.yaml +171 -0
  160. package/v1/providers/lepton.yaml +183 -0
  161. package/v1/providers/minimax.yaml +172 -0
  162. package/v1/providers/mistral.yaml +186 -0
  163. package/v1/providers/moonshot.yaml +176 -0
  164. package/v1/providers/nvidia.yaml +172 -0
  165. package/v1/providers/openai.yaml +224 -0
  166. package/v1/providers/openrouter.yaml +181 -0
  167. package/v1/providers/perplexity.yaml +144 -0
  168. package/v1/providers/qwen.yaml +192 -0
  169. package/v1/providers/replicate.yaml +159 -0
  170. package/v1/providers/sensenova.yaml +153 -0
  171. package/v1/providers/siliconflow.yaml +156 -0
  172. package/v1/providers/spark.yaml +167 -0
  173. package/v1/providers/stability.yaml +185 -0
  174. package/v1/providers/tiangong.yaml +170 -0
  175. package/v1/providers/together.yaml +156 -0
  176. package/v1/providers/writer.yaml +212 -0
  177. package/v1/providers/xai.yaml +206 -0
  178. package/v1/providers/yi.yaml +168 -0
  179. package/v1/providers/zhipu.yaml +171 -0
  180. package/v1/spec.yaml +637 -0
  181. package/v2/providers/anthropic.yaml +244 -0
  182. package/v2/providers/cohere.yaml +75 -0
  183. package/v2/providers/deepseek.yaml +176 -0
  184. package/v2/providers/doubao.yaml +169 -0
  185. package/v2/providers/google.yaml +245 -0
  186. package/v2/providers/jina.yaml +55 -0
  187. package/v2/providers/moonshot.yaml +186 -0
  188. package/v2/providers/openai.yaml +266 -0
  189. package/v2/providers/qwen.yaml +174 -0
  190. package/v2/providers/zhipu.yaml +176 -0
  191. package/v2-alpha/providers/anthropic.yaml +134 -0
  192. package/v2-alpha/providers/gemini.yaml +144 -0
  193. package/v2-alpha/providers/openai.yaml +154 -0
  194. package/v2-alpha/spec.yaml +512 -0
@@ -0,0 +1,205 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json",
3
+ "id": "baichuan",
4
+ "protocol_version": "1.5",
5
+ "name": "百川智能 (Baichuan)",
6
+ "version": "v1",
7
+ "status": "stable",
8
+ "category": "ai_provider",
9
+ "official_url": "https://platform.baichuan-ai.com/docs/api",
10
+ "support_contact": "https://www.baichuan-ai.com/contact",
11
+ "endpoint": {
12
+ "base_url": "https://api.baichuan-ai.com/v1",
13
+ "protocol": "https",
14
+ "timeout_ms": 60000
15
+ },
16
+ "auth": {
17
+ "type": "bearer",
18
+ "token_env": "BAICHUAN_API_KEY"
19
+ },
20
+ "payload_format": "openai_style",
21
+ "api_families": [
22
+ "chat_completions"
23
+ ],
24
+ "default_api_family": "chat_completions",
25
+ "endpoints": {
26
+ "chat": {
27
+ "path": "/chat/completions",
28
+ "method": "POST",
29
+ "adapter": "openai"
30
+ }
31
+ },
32
+ "services": {
33
+ "list_models": {
34
+ "path": "/models",
35
+ "method": "GET",
36
+ "response_binding": "data"
37
+ }
38
+ },
39
+ "termination": {
40
+ "source_field": "finish_reason",
41
+ "mapping": {
42
+ "stop": "end_turn",
43
+ "length": "max_tokens",
44
+ "tool_calls": "tool_use"
45
+ },
46
+ "notes": [
47
+ "OpenAI-compatible finish_reason.",
48
+ "Baichuan is a leading Chinese AI company founded by former Sogou CEO."
49
+ ]
50
+ },
51
+ "tooling": {
52
+ "source_model": "openai_tool_calls",
53
+ "tool_use": {
54
+ "id_path": "id",
55
+ "name_path": "function.name",
56
+ "input_path": "function.arguments",
57
+ "input_format": "json_string"
58
+ },
59
+ "notes": [
60
+ "Supports OpenAI-compatible function calling."
61
+ ]
62
+ },
63
+ "retry_policy": {
64
+ "strategy": "exponential_backoff",
65
+ "max_retries": 3,
66
+ "min_delay_ms": 1000,
67
+ "max_delay_ms": 30000,
68
+ "jitter": "full",
69
+ "retry_on_http_status": [
70
+ 429,
71
+ 500,
72
+ 502,
73
+ 503
74
+ ]
75
+ },
76
+ "error_classification": {
77
+ "by_http_status": {
78
+ "400": "invalid_request",
79
+ "401": "authentication",
80
+ "403": "permission_denied",
81
+ "404": "not_found",
82
+ "429": "rate_limited",
83
+ "500": "server_error",
84
+ "503": "overloaded"
85
+ }
86
+ },
87
+ "parameter_mappings": {
88
+ "temperature": "temperature",
89
+ "max_tokens": "max_tokens",
90
+ "stream": "stream",
91
+ "top_p": "top_p",
92
+ "top_k": "top_k",
93
+ "stop_sequences": "stop",
94
+ "tools": "tools",
95
+ "tool_choice": "tool_choice"
96
+ },
97
+ "response_format": "openai_style",
98
+ "response_paths": {
99
+ "content": "choices[0].message.content",
100
+ "tool_calls": "choices[0].message.tool_calls",
101
+ "usage": "usage",
102
+ "finish_reason": "choices[0].finish_reason"
103
+ },
104
+ "streaming": {
105
+ "event_format": "data_lines",
106
+ "decoder": {
107
+ "format": "sse",
108
+ "delimiter": "\n\n",
109
+ "prefix": "data: ",
110
+ "done_signal": "[DONE]"
111
+ },
112
+ "content_path": "choices[0].delta.content",
113
+ "tool_call_path": "choices[0].delta.tool_calls",
114
+ "usage_path": "usage",
115
+ "frame_selector": "exists($.choices) || exists($.error)",
116
+ "event_map": [
117
+ {
118
+ "match": "exists($.choices[*].delta.content)",
119
+ "emit": "PartialContentDelta",
120
+ "fields": {
121
+ "content": "$.choices[*].delta.content"
122
+ }
123
+ },
124
+ {
125
+ "match": "exists($.choices[*].delta.tool_calls[*].function.name)",
126
+ "emit": "ToolCallStarted",
127
+ "fields": {
128
+ "tool_call_id": "$.choices[*].delta.tool_calls[*].id",
129
+ "tool_name": "$.choices[*].delta.tool_calls[*].function.name",
130
+ "index": "$.choices[*].delta.tool_calls[*].index"
131
+ }
132
+ },
133
+ {
134
+ "match": "exists($.choices[*].delta.tool_calls[*].function.arguments)",
135
+ "emit": "PartialToolCall",
136
+ "fields": {
137
+ "arguments": "$.choices[*].delta.tool_calls[*].function.arguments",
138
+ "index": "$.choices[*].delta.tool_calls[*].index"
139
+ }
140
+ },
141
+ {
142
+ "match": "exists($.usage)",
143
+ "emit": "Metadata",
144
+ "fields": {
145
+ "usage": "$.usage"
146
+ }
147
+ },
148
+ {
149
+ "match": "exists($.choices[*].finish_reason)",
150
+ "emit": "FinalCandidate",
151
+ "fields": {
152
+ "finish_reason": "$.choices[*].finish_reason"
153
+ }
154
+ }
155
+ ],
156
+ "stop_condition": "$.choices[0].finish_reason != null"
157
+ },
158
+ "features": {
159
+ "multi_candidate": {
160
+ "support_type": "native",
161
+ "param_name": "n"
162
+ },
163
+ "response_mapping": {
164
+ "tool_calls": {
165
+ "path": "choices[0].message.tool_calls",
166
+ "fields": {
167
+ "id": "id",
168
+ "name": "function.name",
169
+ "args": "function.arguments"
170
+ }
171
+ },
172
+ "error": {
173
+ "message_path": "error.message",
174
+ "code_path": "error.code"
175
+ }
176
+ }
177
+ },
178
+ "capabilities": {
179
+ "streaming": true,
180
+ "tools": true,
181
+ "vision": false,
182
+ "agentic": true,
183
+ "parallel_tools": false,
184
+ "reasoning": false
185
+ },
186
+ "availability": {
187
+ "required": false,
188
+ "regions": [
189
+ "cn"
190
+ ],
191
+ "check": {
192
+ "method": "GET",
193
+ "path": "/models",
194
+ "expected_status": [
195
+ 200,
196
+ 401
197
+ ],
198
+ "timeout_ms": 5000
199
+ }
200
+ },
201
+ "experimental_features": [
202
+ "knowledge_base",
203
+ "web_search"
204
+ ]
205
+ }
@@ -0,0 +1,205 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json",
3
+ "id": "baidu",
4
+ "protocol_version": "1.5",
5
+ "name": "百度文心 (Baidu ERNIE)",
6
+ "version": "v1",
7
+ "status": "stable",
8
+ "category": "ai_provider",
9
+ "official_url": "https://cloud.baidu.com/doc/WENXINWORKSHOP/index.html",
10
+ "support_contact": "https://cloud.baidu.com/support",
11
+ "endpoint": {
12
+ "base_url": "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop",
13
+ "protocol": "https",
14
+ "timeout_ms": 60000
15
+ },
16
+ "auth": {
17
+ "type": "bearer",
18
+ "token_env": "BAIDU_ACCESS_TOKEN"
19
+ },
20
+ "payload_format": "baidu_style",
21
+ "api_families": [
22
+ "chat"
23
+ ],
24
+ "default_api_family": "chat",
25
+ "endpoints": {
26
+ "chat_ernie4": {
27
+ "path": "/chat/completions_pro",
28
+ "method": "POST",
29
+ "adapter": "baidu"
30
+ },
31
+ "chat_ernie35": {
32
+ "path": "/chat/completions",
33
+ "method": "POST",
34
+ "adapter": "baidu"
35
+ },
36
+ "chat_ernie_speed": {
37
+ "path": "/chat/ernie_speed",
38
+ "method": "POST",
39
+ "adapter": "baidu"
40
+ },
41
+ "chat_ernie_lite": {
42
+ "path": "/chat/ernie-lite-8k",
43
+ "method": "POST",
44
+ "adapter": "baidu"
45
+ }
46
+ },
47
+ "termination": {
48
+ "source_field": "finish_reason",
49
+ "mapping": {
50
+ "normal": "end_turn",
51
+ "stop": "end_turn",
52
+ "length": "max_tokens",
53
+ "content_filter": "refusal",
54
+ "function_call": "tool_use"
55
+ },
56
+ "notes": [
57
+ "Baidu ERNIE uses finish_reason in response.",
58
+ "文心一言 (ERNIE Bot) is Baidu's flagship conversational AI."
59
+ ]
60
+ },
61
+ "tooling": {
62
+ "source_model": "openai_tool_calls",
63
+ "tool_use": {
64
+ "id_path": "id",
65
+ "name_path": "name",
66
+ "input_path": "arguments",
67
+ "input_format": "json_string"
68
+ },
69
+ "notes": [
70
+ "ERNIE supports function calling with similar semantics to OpenAI."
71
+ ]
72
+ },
73
+ "retry_policy": {
74
+ "strategy": "exponential_backoff",
75
+ "max_retries": 3,
76
+ "min_delay_ms": 1000,
77
+ "max_delay_ms": 30000,
78
+ "jitter": "full",
79
+ "retry_on_http_status": [
80
+ 429,
81
+ 500,
82
+ 502,
83
+ 503
84
+ ]
85
+ },
86
+ "error_classification": {
87
+ "by_http_status": {
88
+ "400": "invalid_request",
89
+ "401": "authentication",
90
+ "403": "permission_denied",
91
+ "404": "not_found",
92
+ "429": "rate_limited",
93
+ "500": "server_error",
94
+ "503": "overloaded"
95
+ }
96
+ },
97
+ "parameter_mappings": {
98
+ "temperature": "temperature",
99
+ "max_tokens": "max_output_tokens",
100
+ "stream": "stream",
101
+ "top_p": "top_p",
102
+ "stop_sequences": "stop",
103
+ "tools": "functions",
104
+ "system_message": "system"
105
+ },
106
+ "response_format": "baidu_style",
107
+ "response_paths": {
108
+ "content": "result",
109
+ "function_call": "function_call",
110
+ "usage": "usage",
111
+ "finish_reason": "finish_reason"
112
+ },
113
+ "streaming": {
114
+ "event_format": "data_lines",
115
+ "decoder": {
116
+ "format": "sse",
117
+ "delimiter": "\n\n",
118
+ "prefix": "data: ",
119
+ "done_signal": ""
120
+ },
121
+ "content_path": "result",
122
+ "usage_path": "usage",
123
+ "frame_selector": "exists($.result) || exists($.error_code)",
124
+ "event_map": [
125
+ {
126
+ "match": "exists($.result)",
127
+ "emit": "PartialContentDelta",
128
+ "fields": {
129
+ "content": "$.result"
130
+ }
131
+ },
132
+ {
133
+ "match": "exists($.function_call)",
134
+ "emit": "ToolCallStarted",
135
+ "fields": {
136
+ "tool_name": "$.function_call.name",
137
+ "arguments": "$.function_call.arguments"
138
+ }
139
+ },
140
+ {
141
+ "match": "exists($.usage)",
142
+ "emit": "Metadata",
143
+ "fields": {
144
+ "usage": "$.usage"
145
+ }
146
+ },
147
+ {
148
+ "match": "$.is_end == true",
149
+ "emit": "FinalCandidate",
150
+ "fields": {
151
+ "finish_reason": "$.finish_reason"
152
+ }
153
+ }
154
+ ],
155
+ "stop_condition": "$.is_end == true"
156
+ },
157
+ "features": {
158
+ "multi_candidate": {
159
+ "support_type": "simulated",
160
+ "max_concurrent": 1
161
+ },
162
+ "response_mapping": {
163
+ "function_call": {
164
+ "path": "function_call",
165
+ "fields": {
166
+ "name": "name",
167
+ "args": "arguments"
168
+ }
169
+ },
170
+ "error": {
171
+ "message_path": "error_msg",
172
+ "code_path": "error_code"
173
+ }
174
+ }
175
+ },
176
+ "capabilities": {
177
+ "streaming": true,
178
+ "tools": true,
179
+ "vision": true,
180
+ "agentic": true,
181
+ "parallel_tools": false,
182
+ "reasoning": false
183
+ },
184
+ "availability": {
185
+ "required": false,
186
+ "regions": [
187
+ "cn"
188
+ ],
189
+ "check": {
190
+ "method": "GET",
191
+ "path": "/chat/completions",
192
+ "expected_status": [
193
+ 200,
194
+ 401,
195
+ 403
196
+ ],
197
+ "timeout_ms": 5000
198
+ }
199
+ },
200
+ "experimental_features": [
201
+ "knowledge_base",
202
+ "plugins",
203
+ "image_understanding"
204
+ ]
205
+ }
@@ -0,0 +1,216 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json",
3
+ "id": "cerebras",
4
+ "protocol_version": "1.5",
5
+ "name": "Cerebras",
6
+ "version": "v1",
7
+ "status": "stable",
8
+ "category": "ai_provider",
9
+ "official_url": "https://inference-docs.cerebras.ai",
10
+ "support_contact": "https://cerebras.ai/contact",
11
+ "endpoint": {
12
+ "base_url": "https://api.cerebras.ai/v1",
13
+ "protocol": "https",
14
+ "timeout_ms": 10000
15
+ },
16
+ "auth": {
17
+ "type": "bearer",
18
+ "token_env": "CEREBRAS_API_KEY"
19
+ },
20
+ "payload_format": "openai_style",
21
+ "api_families": [
22
+ "chat_completions"
23
+ ],
24
+ "default_api_family": "chat_completions",
25
+ "endpoints": {
26
+ "chat": {
27
+ "path": "/chat/completions",
28
+ "method": "POST",
29
+ "adapter": "openai"
30
+ }
31
+ },
32
+ "services": {
33
+ "list_models": {
34
+ "path": "/models",
35
+ "method": "GET",
36
+ "response_binding": "data"
37
+ }
38
+ },
39
+ "termination": {
40
+ "source_field": "finish_reason",
41
+ "mapping": {
42
+ "stop": "end_turn",
43
+ "length": "max_tokens",
44
+ "tool_calls": "tool_use"
45
+ },
46
+ "notes": [
47
+ "OpenAI-compatible finish_reason.",
48
+ "Cerebras is known for extremely fast inference (thousands of tokens/second)."
49
+ ]
50
+ },
51
+ "tooling": {
52
+ "source_model": "openai_tool_calls",
53
+ "tool_use": {
54
+ "id_path": "id",
55
+ "name_path": "function.name",
56
+ "input_path": "function.arguments",
57
+ "input_format": "json_string"
58
+ },
59
+ "notes": [
60
+ "Standard OpenAI-compatible tool calling."
61
+ ]
62
+ },
63
+ "rate_limit_headers": {
64
+ "requests_limit": "x-ratelimit-limit-requests",
65
+ "requests_remaining": "x-ratelimit-remaining-requests",
66
+ "tokens_limit": "x-ratelimit-limit-tokens",
67
+ "tokens_remaining": "x-ratelimit-remaining-tokens"
68
+ },
69
+ "retry_policy": {
70
+ "strategy": "exponential_backoff",
71
+ "max_retries": 3,
72
+ "min_delay_ms": 500,
73
+ "max_delay_ms": 10000,
74
+ "jitter": "full",
75
+ "retry_on_http_status": [
76
+ 429,
77
+ 500,
78
+ 502,
79
+ 503
80
+ ],
81
+ "notes": [
82
+ "Cerebras inference is extremely fast; shorter retry delays are appropriate."
83
+ ]
84
+ },
85
+ "error_classification": {
86
+ "by_http_status": {
87
+ "400": "invalid_request",
88
+ "401": "authentication",
89
+ "403": "permission_denied",
90
+ "404": "not_found",
91
+ "429": "rate_limited",
92
+ "500": "server_error",
93
+ "503": "overloaded"
94
+ }
95
+ },
96
+ "parameter_mappings": {
97
+ "temperature": "temperature",
98
+ "max_tokens": "max_tokens",
99
+ "stream": "stream",
100
+ "top_p": "top_p",
101
+ "stop_sequences": "stop",
102
+ "tools": "tools",
103
+ "tool_choice": "tool_choice",
104
+ "seed": "seed"
105
+ },
106
+ "response_format": "openai_style",
107
+ "response_paths": {
108
+ "content": "choices[0].message.content",
109
+ "tool_calls": "choices[0].message.tool_calls",
110
+ "usage": "usage",
111
+ "finish_reason": "choices[0].finish_reason"
112
+ },
113
+ "streaming": {
114
+ "event_format": "data_lines",
115
+ "decoder": {
116
+ "format": "sse",
117
+ "delimiter": "\n\n",
118
+ "prefix": "data: ",
119
+ "done_signal": "[DONE]"
120
+ },
121
+ "content_path": "choices[0].delta.content",
122
+ "tool_call_path": "choices[0].delta.tool_calls",
123
+ "usage_path": "usage",
124
+ "frame_selector": "exists($.choices) || exists($.error)",
125
+ "event_map": [
126
+ {
127
+ "match": "exists($.choices[*].delta.content)",
128
+ "emit": "PartialContentDelta",
129
+ "fields": {
130
+ "content": "$.choices[*].delta.content"
131
+ }
132
+ },
133
+ {
134
+ "match": "exists($.choices[*].delta.tool_calls[*].function.name)",
135
+ "emit": "ToolCallStarted",
136
+ "fields": {
137
+ "tool_call_id": "$.choices[*].delta.tool_calls[*].id",
138
+ "tool_name": "$.choices[*].delta.tool_calls[*].function.name",
139
+ "index": "$.choices[*].delta.tool_calls[*].index"
140
+ }
141
+ },
142
+ {
143
+ "match": "exists($.choices[*].delta.tool_calls[*].function.arguments)",
144
+ "emit": "PartialToolCall",
145
+ "fields": {
146
+ "arguments": "$.choices[*].delta.tool_calls[*].function.arguments",
147
+ "index": "$.choices[*].delta.tool_calls[*].index"
148
+ }
149
+ },
150
+ {
151
+ "match": "exists($.usage)",
152
+ "emit": "Metadata",
153
+ "fields": {
154
+ "usage": "$.usage"
155
+ }
156
+ },
157
+ {
158
+ "match": "exists($.choices[*].finish_reason)",
159
+ "emit": "FinalCandidate",
160
+ "fields": {
161
+ "finish_reason": "$.choices[*].finish_reason",
162
+ "candidate_index": "$.choices[*].index"
163
+ }
164
+ }
165
+ ],
166
+ "stop_condition": "$.choices[0].finish_reason != null"
167
+ },
168
+ "features": {
169
+ "multi_candidate": {
170
+ "support_type": "native",
171
+ "param_name": "n"
172
+ },
173
+ "response_mapping": {
174
+ "tool_calls": {
175
+ "path": "choices[0].message.tool_calls",
176
+ "fields": {
177
+ "id": "id",
178
+ "name": "function.name",
179
+ "args": "function.arguments"
180
+ }
181
+ },
182
+ "error": {
183
+ "message_path": "error.message",
184
+ "code_path": "error.code",
185
+ "type_path": "error.type"
186
+ }
187
+ }
188
+ },
189
+ "capabilities": {
190
+ "streaming": true,
191
+ "tools": true,
192
+ "vision": false,
193
+ "agentic": true,
194
+ "parallel_tools": true,
195
+ "reasoning": false
196
+ },
197
+ "availability": {
198
+ "required": false,
199
+ "regions": [
200
+ "global"
201
+ ],
202
+ "check": {
203
+ "method": "GET",
204
+ "path": "/models",
205
+ "expected_status": [
206
+ 200,
207
+ 401
208
+ ],
209
+ "timeout_ms": 3000
210
+ }
211
+ },
212
+ "experimental_features": [
213
+ "ultra_fast_inference",
214
+ "wafer_scale_engine"
215
+ ]
216
+ }