@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,192 @@
1
+ $schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
2
+
3
+ id: qwen
4
+ protocol_version: "1.5"
5
+
6
+ name: Qwen (DashScope)
7
+ version: "v1"
8
+ status: stable
9
+ category: ai_provider
10
+ official_url: "https://help.aliyun.com/zh/model-studio"
11
+ support_contact: "https://help.aliyun.com"
12
+
13
+ endpoint:
14
+ base_url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
15
+ protocol: https
16
+ timeout_ms: 10000
17
+ auth:
18
+ type: bearer
19
+ token_env: "QWEN_API_KEY"
20
+ payload_format: "openai_style"
21
+
22
+ # OpenAI-compatible API families (DashScope compatible-mode)
23
+ api_families: ["chat_completions", "completions"]
24
+ default_api_family: "chat_completions"
25
+ endpoints:
26
+ # Runtime uses UnifiedRequest.operation (currently "chat") to resolve endpoints.
27
+ chat:
28
+ path: "/chat/completions"
29
+ method: "POST"
30
+ adapter: "openai"
31
+ completions:
32
+ path: "/completions"
33
+ method: "POST"
34
+ adapter: "openai"
35
+
36
+ # Service endpoints (used by online fact-checking / registry verification)
37
+ services:
38
+ list_models:
39
+ path: "/models"
40
+ method: "GET"
41
+ response_binding: "data"
42
+
43
+ # Termination reason normalization (see v1/spec.yaml: standard_schema.streaming_events.termination_reasons)
44
+ termination:
45
+ source_field: "finish_reason"
46
+ mapping:
47
+ stop: "end_turn"
48
+ length: "max_tokens"
49
+ tool_calls: "tool_use"
50
+ content_filter: "refusal"
51
+ notes:
52
+ - "OpenAI-compatible: finish_reason is reported per candidate."
53
+
54
+ # Tool invocation normalization (see v1/spec.yaml: standard_schema.content_blocks)
55
+ tooling:
56
+ source_model: "openai_tool_calls"
57
+ tool_use:
58
+ id_path: "id"
59
+ name_path: "function.name"
60
+ input_path: "function.arguments"
61
+ input_format: "json_string"
62
+ notes:
63
+ - "OpenAI-compatible tool_calls.function.arguments is typically a JSON string; runtimes SHOULD parse it into an object when normalizing."
64
+
65
+ # Rate limits (OpenAI-compatible; see OpenAI rate limits guide)
66
+ rate_limit_headers:
67
+ requests_limit: "x-ratelimit-limit-requests"
68
+ tokens_limit: "x-ratelimit-limit-tokens"
69
+ requests_remaining: "x-ratelimit-remaining-requests"
70
+ tokens_remaining: "x-ratelimit-remaining-tokens"
71
+ requests_reset: "x-ratelimit-reset-requests"
72
+ tokens_reset: "x-ratelimit-reset-tokens"
73
+ retry_after: "retry-after"
74
+
75
+ # Retry policy (VERIFIED/secondary: short exponential backoff with small retry cap is common in client libs;
76
+ # official docs confirm 429/500/503 meanings but do not prescribe an exact algorithm)
77
+ retry_policy:
78
+ strategy: "exponential_backoff"
79
+ max_retries: 2
80
+ min_delay_ms: 1000
81
+ max_delay_ms: 8000
82
+ jitter: "full"
83
+ retry_on_http_status: [408, 409, 429, 500, 503]
84
+ notes:
85
+ - "429 can mean rate limit exceeded (QPS/QPM/other limits) OR quota/payment issue; runtimes SHOULD inspect error messages and avoid infinite retries on quota/payment problems."
86
+ - "On 429, runtimes SHOULD respect Retry-After when present."
87
+ - "500/503 are server-side/transient; retry after a brief wait."
88
+ - "408/409 are commonly retried by client libraries with short exponential backoff."
89
+
90
+ # Error classification hints (see v1/spec.yaml: standard_schema.error_handling.error_classes)
91
+ error_classification:
92
+ by_http_status:
93
+ "400": "invalid_request"
94
+ "401": "authentication"
95
+ "429": "rate_limited"
96
+ "500": "server_error"
97
+ "503": "overloaded"
98
+ notes:
99
+ - "Qwen/DashScope 429 may indicate quota/payment issue; runtimes SHOULD treat as quota_exhausted when the message indicates quota/payment."
100
+ parameter_mappings:
101
+ temperature: "temperature"
102
+ max_tokens: "max_tokens"
103
+ stream: "stream"
104
+ top_p: "top_p"
105
+ stop_sequences: "stop"
106
+ tools: "tools"
107
+ tool_choice: "tool_choice"
108
+ response_format: "openai_style"
109
+ response_paths:
110
+ content: "choices[0].message.content"
111
+ tool_calls: "choices[0].message.tool_calls"
112
+ usage: "usage"
113
+ finish_reason: "choices[0].finish_reason"
114
+ streaming:
115
+ event_format: "data_lines"
116
+ decoder:
117
+ format: "sse"
118
+ delimiter: "\n\n"
119
+ prefix: "data: "
120
+ done_signal: "[DONE]"
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
+ # Text content delta
127
+ - match: "exists($.choices[*].delta.content)"
128
+ emit: "PartialContentDelta"
129
+ fields:
130
+ content: "$.choices[*].delta.content"
131
+ # Tool call start
132
+ - match: "exists($.choices[*].delta.tool_calls[*].function.name)"
133
+ emit: "ToolCallStarted"
134
+ fields:
135
+ tool_call_id: "$.choices[*].delta.tool_calls[*].id"
136
+ tool_name: "$.choices[*].delta.tool_calls[*].function.name"
137
+ index: "$.choices[*].delta.tool_calls[*].index"
138
+ # Tool call arguments streaming
139
+ - match: "exists($.choices[*].delta.tool_calls[*].function.arguments)"
140
+ emit: "PartialToolCall"
141
+ fields:
142
+ arguments: "$.choices[*].delta.tool_calls[*].function.arguments"
143
+ index: "$.choices[*].delta.tool_calls[*].index"
144
+ # Usage metadata
145
+ - match: "exists($.usage)"
146
+ emit: "Metadata"
147
+ fields:
148
+ usage: "$.usage"
149
+ # Finish with reason
150
+ - match: "exists($.choices[*].finish_reason)"
151
+ emit: "FinalCandidate"
152
+ fields:
153
+ finish_reason: "$.choices[*].finish_reason"
154
+ candidate_index: "$.choices[*].index"
155
+ stop_condition: "$.choices[0].finish_reason != null"
156
+ features:
157
+ multi_candidate:
158
+ support_type: "native"
159
+ param_name: "n"
160
+ response_mapping:
161
+ tool_calls:
162
+ path: "choices[0].message.tool_calls"
163
+ fields:
164
+ id: "id"
165
+ name: "function.name"
166
+ args: "function.arguments"
167
+ error:
168
+ message_path: "error.message"
169
+ code_path: "error.code"
170
+ type_path: "error.type"
171
+ param_path: "error.param"
172
+ capabilities:
173
+ streaming: true
174
+ tools: true
175
+ vision: true
176
+ agentic: true
177
+ parallel_tools: false
178
+ reasoning: false
179
+
180
+ availability:
181
+ required: false
182
+ regions:
183
+ - cn
184
+ - global
185
+ check:
186
+ method: GET
187
+ path: "/models"
188
+ expected_status: [200, 401]
189
+ timeout_ms: 3000
190
+ experimental_features:
191
+ - "multilingual_support"
192
+ - "qwen_agent"
@@ -0,0 +1,159 @@
1
+ $schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
2
+
3
+ id: replicate
4
+ protocol_version: "1.5"
5
+
6
+ name: Replicate
7
+ version: "v1"
8
+ status: stable
9
+ category: model_provider
10
+ official_url: "https://replicate.com/docs"
11
+ support_contact: "https://replicate.com/contact"
12
+
13
+ endpoint:
14
+ base_url: "https://api.replicate.com/v1"
15
+ protocol: https
16
+ timeout_ms: 60000
17
+
18
+ auth:
19
+ type: bearer
20
+ token_env: "REPLICATE_API_TOKEN"
21
+
22
+ payload_format: "replicate_style"
23
+
24
+ # Replicate has its own prediction API and OpenAI-compatible endpoints
25
+ api_families: ["predictions", "openai_compatible"]
26
+ default_api_family: "predictions"
27
+
28
+ endpoints:
29
+ chat:
30
+ path: "/models/{owner}/{model}/predictions"
31
+ method: "POST"
32
+ adapter: "replicate"
33
+ # OpenAI-compatible endpoint for supported models
34
+ openai_chat:
35
+ path: "/openai/v1/chat/completions"
36
+ method: "POST"
37
+ adapter: "openai"
38
+
39
+ services:
40
+ list_models:
41
+ path: "/models"
42
+ method: "GET"
43
+ response_binding: "results"
44
+ get_prediction:
45
+ path: "/predictions/{id}"
46
+ method: "GET"
47
+ cancel_prediction:
48
+ path: "/predictions/{id}/cancel"
49
+ method: "POST"
50
+
51
+ termination:
52
+ source_field: "status"
53
+ mapping:
54
+ succeeded: "end_turn"
55
+ failed: "other"
56
+ canceled: "cancelled"
57
+ notes:
58
+ - "Replicate uses async predictions with status polling."
59
+ - "For streaming, use the stream parameter."
60
+
61
+ tooling:
62
+ source_model: "unknown"
63
+ notes:
64
+ - "Tool calling support varies by model."
65
+ - "Some models support OpenAI-compatible function calling via the openai endpoint."
66
+
67
+ retry_policy:
68
+ strategy: "exponential_backoff"
69
+ max_retries: 3
70
+ min_delay_ms: 1000
71
+ max_delay_ms: 30000
72
+ jitter: "full"
73
+ retry_on_http_status: [429, 500, 502, 503, 504]
74
+ notes:
75
+ - "Replicate may return 503 when models are cold-starting."
76
+ - "Consider longer timeouts for initial requests."
77
+
78
+ error_classification:
79
+ by_http_status:
80
+ "400": "invalid_request"
81
+ "401": "authentication"
82
+ "402": "quota_exhausted"
83
+ "403": "permission_denied"
84
+ "404": "not_found"
85
+ "422": "invalid_request"
86
+ "429": "rate_limited"
87
+ "500": "server_error"
88
+ "503": "overloaded"
89
+
90
+ parameter_mappings:
91
+ temperature: "input.temperature"
92
+ max_tokens: "input.max_tokens"
93
+ stream: "stream"
94
+ top_p: "input.top_p"
95
+ stop_sequences: "input.stop"
96
+ prompt: "input.prompt"
97
+ system_message: "input.system_prompt"
98
+
99
+ response_format: "replicate_style"
100
+
101
+ response_paths:
102
+ content: "output"
103
+ status: "status"
104
+ error: "error"
105
+
106
+ streaming:
107
+ event_format: "sse"
108
+ decoder:
109
+ format: "sse"
110
+ delimiter: "\n\n"
111
+ prefix: "data: "
112
+ done_signal: "done"
113
+ content_path: "output"
114
+ event_map:
115
+ - match: "$.event == 'output'"
116
+ emit: "PartialContentDelta"
117
+ fields:
118
+ content: "$.data"
119
+ - match: "$.event == 'done'"
120
+ emit: "StreamEnd"
121
+ fields:
122
+ finish_reason: "end_turn"
123
+ - match: "$.event == 'error'"
124
+ emit: "StreamError"
125
+ fields:
126
+ error: "$.data"
127
+ stop_condition: "$.event == 'done'"
128
+
129
+ features:
130
+ multi_candidate:
131
+ support_type: "simulated"
132
+ max_concurrent: 4
133
+ response_mapping:
134
+ error:
135
+ message_path: "detail"
136
+ type_path: "type"
137
+
138
+ capabilities:
139
+ streaming: true
140
+ tools: false
141
+ vision: true
142
+ agentic: false
143
+ parallel_tools: false
144
+ reasoning: false
145
+
146
+ availability:
147
+ required: false
148
+ regions:
149
+ - global
150
+ check:
151
+ method: GET
152
+ path: "/models"
153
+ expected_status: [200, 401]
154
+ timeout_ms: 5000
155
+
156
+ experimental_features:
157
+ - "async_predictions"
158
+ - "webhooks"
159
+ - "cold_boot_optimization"
@@ -0,0 +1,153 @@
1
+ $schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
2
+
3
+ id: sensenova
4
+ protocol_version: "1.5"
5
+
6
+ name: 商汤日日新 (SenseNova)
7
+ version: "v1"
8
+ status: stable
9
+ category: ai_provider
10
+ official_url: "https://platform.sensenova.cn/doc"
11
+ support_contact: "https://www.sensetime.com/contact"
12
+
13
+ endpoint:
14
+ base_url: "https://api.sensenova.cn/v1"
15
+ protocol: https
16
+ timeout_ms: 60000
17
+
18
+ auth:
19
+ type: bearer
20
+ token_env: "SENSENOVA_API_KEY"
21
+
22
+ payload_format: "openai_style"
23
+
24
+ # SenseNova uses OpenAI-compatible API
25
+ api_families: ["chat_completions"]
26
+ default_api_family: "chat_completions"
27
+
28
+ endpoints:
29
+ chat:
30
+ path: "/llm/chat-completions"
31
+ method: "POST"
32
+ adapter: "sensenova"
33
+
34
+ services:
35
+ list_models:
36
+ path: "/llm/models"
37
+ method: "GET"
38
+
39
+ termination:
40
+ source_field: "finish_reason"
41
+ mapping:
42
+ stop: "end_turn"
43
+ length: "max_tokens"
44
+ tool_calls: "tool_use"
45
+ notes:
46
+ - "日日新 (SenseNova) is SenseTime's flagship AI platform."
47
+ - "Includes SenseChat and other foundation models."
48
+
49
+ tooling:
50
+ source_model: "openai_tool_calls"
51
+ tool_use:
52
+ id_path: "id"
53
+ name_path: "function.name"
54
+ input_path: "function.arguments"
55
+ input_format: "json_string"
56
+ notes:
57
+ - "Supports function calling similar to OpenAI."
58
+
59
+ retry_policy:
60
+ strategy: "exponential_backoff"
61
+ max_retries: 3
62
+ min_delay_ms: 1000
63
+ max_delay_ms: 30000
64
+ jitter: "full"
65
+ retry_on_http_status: [429, 500, 502, 503]
66
+
67
+ error_classification:
68
+ by_http_status:
69
+ "400": "invalid_request"
70
+ "401": "authentication"
71
+ "403": "permission_denied"
72
+ "404": "not_found"
73
+ "429": "rate_limited"
74
+ "500": "server_error"
75
+ "503": "overloaded"
76
+
77
+ parameter_mappings:
78
+ temperature: "temperature"
79
+ max_tokens: "max_new_tokens"
80
+ stream: "stream"
81
+ top_p: "top_p"
82
+ frequency_penalty: "repetition_penalty"
83
+ tools: "tools"
84
+ tool_choice: "tool_choice"
85
+
86
+ response_format: "sensenova_style"
87
+
88
+ response_paths:
89
+ content: "data.choices[0].message"
90
+ tool_calls: "data.choices[0].tool_calls"
91
+ usage: "data.usage"
92
+ finish_reason: "data.choices[0].finish_reason"
93
+
94
+ streaming:
95
+ event_format: "sse"
96
+ decoder:
97
+ format: "sse"
98
+ delimiter: "\n\n"
99
+ prefix: "data: "
100
+ done_signal: "[DONE]"
101
+ content_path: "data.choices[0].delta"
102
+ usage_path: "data.usage"
103
+ frame_selector: "exists($.data.choices) || exists($.error)"
104
+ event_map:
105
+ - match: "exists($.data.choices[*].delta)"
106
+ emit: "PartialContentDelta"
107
+ fields:
108
+ content: "$.data.choices[*].delta"
109
+ - match: "exists($.data.choices[*].tool_calls[*].function.name)"
110
+ emit: "ToolCallStarted"
111
+ fields:
112
+ tool_name: "$.data.choices[*].tool_calls[*].function.name"
113
+ - match: "exists($.data.usage)"
114
+ emit: "Metadata"
115
+ fields:
116
+ usage: "$.data.usage"
117
+ - match: "exists($.data.choices[*].finish_reason)"
118
+ emit: "FinalCandidate"
119
+ fields:
120
+ finish_reason: "$.data.choices[*].finish_reason"
121
+ stop_condition: "$.data.choices[0].finish_reason != null"
122
+
123
+ features:
124
+ multi_candidate:
125
+ support_type: "native"
126
+ param_name: "n"
127
+ response_mapping:
128
+ error:
129
+ message_path: "error.message"
130
+ code_path: "error.code"
131
+
132
+ capabilities:
133
+ streaming: true
134
+ tools: true
135
+ vision: true
136
+ agentic: true
137
+ parallel_tools: false
138
+ reasoning: false
139
+
140
+ availability:
141
+ required: false
142
+ regions:
143
+ - cn
144
+ check:
145
+ method: GET
146
+ path: "/llm/models"
147
+ expected_status: [200, 401]
148
+ timeout_ms: 5000
149
+
150
+ experimental_features:
151
+ - "multimodal"
152
+ - "code_generation"
153
+ - "knowledge_base"
@@ -0,0 +1,156 @@
1
+ $schema: ../../schemas/v1.json
2
+ protocol_version: "1.5"
3
+ id: "siliconflow"
4
+ name: "SiliconFlow"
5
+ status: "stable"
6
+ category: "model_provider"
7
+ official_url: "https://siliconflow.cn/"
8
+ support_contact: "https://siliconflow.cn/support"
9
+
10
+ endpoint:
11
+ base_url: "https://api.siliconflow.cn/v1"
12
+ protocol: "https"
13
+ timeout_ms: 60000
14
+
15
+ # Auth + payload format are required for online model fact-checking.
16
+ auth:
17
+ type: bearer
18
+ token_env: "SILICONFLOW_API_KEY"
19
+ payload_format: "openai_style"
20
+
21
+ services:
22
+ list_models:
23
+ path: "/models"
24
+ method: "GET"
25
+ response_binding: "data"
26
+
27
+ availability:
28
+ required: false
29
+ regions: ["cn", "global"]
30
+ check:
31
+ method: "GET"
32
+ path: "/models"
33
+ expected_status: [200]
34
+
35
+ capabilities:
36
+ streaming: true
37
+ tools: true
38
+ vision: true
39
+ agentic: false
40
+ reasoning: true
41
+ parallel_tools: true
42
+
43
+ # SiliconCloud is OpenAI-compatible
44
+ streaming:
45
+ event_format: "data_lines"
46
+ decoder:
47
+ format: "sse"
48
+ delimiter: "\n\n"
49
+ prefix: "data: "
50
+ done_signal: "[DONE]"
51
+ frame_selector: "exists($.choices) || exists($.error)"
52
+ candidate:
53
+ candidate_id_path: "$.choices[*].index"
54
+ fan_out: true
55
+ event_map:
56
+ - match: "exists($.error)"
57
+ emit: "StreamError"
58
+ fields:
59
+ error: "$.error"
60
+ - match: "exists($.choices[*].delta.content)"
61
+ emit: "PartialContentDelta"
62
+ fields:
63
+ content: "$.choices[*].delta.content"
64
+ - match: "exists($.choices[*].delta.tool_calls[*].function.name)"
65
+ emit: "ToolCallStarted"
66
+ fields:
67
+ tool_call_id: "$.choices[*].delta.tool_calls[*].id"
68
+ tool_name: "$.choices[*].delta.tool_calls[*].function.name"
69
+ index: "$.choices[*].delta.tool_calls[*].index"
70
+ - match: "exists($.choices[*].delta.tool_calls[*].function.arguments)"
71
+ emit: "PartialToolCall"
72
+ fields:
73
+ arguments: "$.choices[*].delta.tool_calls[*].function.arguments"
74
+ index: "$.choices[*].delta.tool_calls[*].index"
75
+ - match: "exists($.usage)"
76
+ emit: "Metadata"
77
+ fields:
78
+ usage: "$.usage"
79
+ - match: "exists($.choices[*].finish_reason)"
80
+ emit: "FinalCandidate"
81
+ fields:
82
+ finish_reason: "$.choices[*].finish_reason"
83
+ candidate_index: "$.choices[*].index"
84
+ stop_condition: "$.choices[0].finish_reason != null"
85
+ extra_metadata_path: "$.usage"
86
+ content_path: "$.choices[0].delta.content"
87
+ tool_call_path: "$.choices[0].delta.tool_calls"
88
+
89
+ # Termination reason normalization (SiliconFlow uses OpenAI-compatible finish_reason)
90
+ termination:
91
+ source_field: "finish_reason"
92
+ mapping:
93
+ stop: "end_turn"
94
+ length: "max_tokens"
95
+ tool_calls: "tool_use"
96
+ content_filter: "refusal"
97
+ notes:
98
+ - "finish_reason is reported per candidate."
99
+
100
+ # Tool invocation normalization (SiliconFlow is OpenAI-compatible)
101
+ tooling:
102
+ source_model: "openai_tool_calls"
103
+ tool_use:
104
+ id_path: "id"
105
+ name_path: "function.name"
106
+ input_path: "function.arguments"
107
+ input_format: "json_string"
108
+ notes:
109
+ - "SiliconFlow tool_calls.function.arguments is typically a JSON string."
110
+
111
+ features:
112
+ multi_candidate:
113
+ support_type: "native"
114
+ param_name: "n"
115
+ response_mapping:
116
+ tool_calls:
117
+ path: "choices[0].message.tool_calls"
118
+ fields:
119
+ id: "id"
120
+ name: "function.name"
121
+ args: "function.arguments"
122
+ error:
123
+ message_path: "error.message"
124
+ code_path: "error.code"
125
+
126
+ response_paths:
127
+ content: "choices[0].message.content"
128
+ tool_calls: "choices[0].message.tool_calls"
129
+ usage: "usage"
130
+ finish_reason: "choices[0].finish_reason"
131
+
132
+ parameter_mappings:
133
+ temperature: "temperature"
134
+ max_tokens: "max_tokens"
135
+ stream: "stream"
136
+ top_p: "top_p"
137
+ stop_sequences: "stop"
138
+ tools: "tools"
139
+ tool_choice: "tool_choice"
140
+
141
+ retry_policy:
142
+ max_retries: 3
143
+ max_delay_ms: 30000
144
+ strategy: "exponential_backoff"
145
+ min_delay_ms: 1000
146
+ jitter: "full"
147
+ retry_on_http_status: [429, 500, 502, 503]
148
+
149
+ error_classification:
150
+ by_http_status:
151
+ "400": "invalid_request"
152
+ "401": "authentication"
153
+ "403": "permission_denied"
154
+ "429": "rate_limited"
155
+ "500": "server_error"
156
+ "503": "overloaded"