@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,172 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json",
3
+ "id": "perplexity",
4
+ "protocol_version": "1.5",
5
+ "name": "Perplexity",
6
+ "version": "v1",
7
+ "status": "stable",
8
+ "category": "ai_provider",
9
+ "official_url": "https://docs.perplexity.ai",
10
+ "support_contact": "https://www.perplexity.ai/contact",
11
+ "endpoint": {
12
+ "base_url": "https://api.perplexity.ai",
13
+ "protocol": "https",
14
+ "timeout_ms": 60000
15
+ },
16
+ "auth": {
17
+ "type": "bearer",
18
+ "token_env": "PPLX_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
+ },
45
+ "notes": [
46
+ "Perplexity is known for search-augmented AI responses.",
47
+ "Returns citations in responses when using online models."
48
+ ]
49
+ },
50
+ "tooling": {
51
+ "source_model": "unknown",
52
+ "notes": [
53
+ "Perplexity focuses on search/RAG, limited tool support."
54
+ ]
55
+ },
56
+ "retry_policy": {
57
+ "strategy": "exponential_backoff",
58
+ "max_retries": 3,
59
+ "min_delay_ms": 1000,
60
+ "max_delay_ms": 30000,
61
+ "jitter": "full",
62
+ "retry_on_http_status": [
63
+ 429,
64
+ 500,
65
+ 502,
66
+ 503
67
+ ]
68
+ },
69
+ "error_classification": {
70
+ "by_http_status": {
71
+ "400": "invalid_request",
72
+ "401": "authentication",
73
+ "403": "permission_denied",
74
+ "404": "not_found",
75
+ "429": "rate_limited",
76
+ "500": "server_error",
77
+ "503": "overloaded"
78
+ }
79
+ },
80
+ "parameter_mappings": {
81
+ "temperature": "temperature",
82
+ "max_tokens": "max_tokens",
83
+ "stream": "stream",
84
+ "top_p": "top_p",
85
+ "frequency_penalty": "frequency_penalty",
86
+ "presence_penalty": "presence_penalty"
87
+ },
88
+ "response_format": "openai_style",
89
+ "response_paths": {
90
+ "content": "choices[0].message.content",
91
+ "usage": "usage",
92
+ "finish_reason": "choices[0].finish_reason",
93
+ "citations": "citations"
94
+ },
95
+ "streaming": {
96
+ "event_format": "data_lines",
97
+ "decoder": {
98
+ "format": "sse",
99
+ "delimiter": "\n\n",
100
+ "prefix": "data: ",
101
+ "done_signal": "[DONE]"
102
+ },
103
+ "content_path": "choices[0].delta.content",
104
+ "usage_path": "usage",
105
+ "frame_selector": "exists($.choices) || exists($.error)",
106
+ "event_map": [
107
+ {
108
+ "match": "exists($.choices[*].delta.content)",
109
+ "emit": "PartialContentDelta",
110
+ "fields": {
111
+ "content": "$.choices[*].delta.content"
112
+ }
113
+ },
114
+ {
115
+ "match": "exists($.usage)",
116
+ "emit": "Metadata",
117
+ "fields": {
118
+ "usage": "$.usage"
119
+ }
120
+ },
121
+ {
122
+ "match": "exists($.choices[*].finish_reason)",
123
+ "emit": "FinalCandidate",
124
+ "fields": {
125
+ "finish_reason": "$.choices[*].finish_reason"
126
+ }
127
+ }
128
+ ],
129
+ "stop_condition": "$.choices[0].finish_reason != null"
130
+ },
131
+ "features": {
132
+ "multi_candidate": {
133
+ "support_type": "simulated",
134
+ "max_concurrent": 1
135
+ },
136
+ "response_mapping": {
137
+ "error": {
138
+ "message_path": "error.message",
139
+ "code_path": "error.code",
140
+ "type_path": "error.type"
141
+ }
142
+ }
143
+ },
144
+ "capabilities": {
145
+ "streaming": true,
146
+ "tools": false,
147
+ "vision": false,
148
+ "agentic": false,
149
+ "parallel_tools": false,
150
+ "reasoning": false
151
+ },
152
+ "availability": {
153
+ "required": false,
154
+ "regions": [
155
+ "global"
156
+ ],
157
+ "check": {
158
+ "method": "GET",
159
+ "path": "/models",
160
+ "expected_status": [
161
+ 200,
162
+ 401
163
+ ],
164
+ "timeout_ms": 5000
165
+ }
166
+ },
167
+ "experimental_features": [
168
+ "online_search",
169
+ "citations",
170
+ "related_questions"
171
+ ]
172
+ }
@@ -0,0 +1,231 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json",
3
+ "id": "qwen",
4
+ "protocol_version": "1.5",
5
+ "name": "Qwen (DashScope)",
6
+ "version": "v1",
7
+ "status": "stable",
8
+ "category": "ai_provider",
9
+ "official_url": "https://help.aliyun.com/zh/model-studio",
10
+ "support_contact": "https://help.aliyun.com",
11
+ "endpoint": {
12
+ "base_url": "https://dashscope.aliyuncs.com/compatible-mode/v1",
13
+ "protocol": "https",
14
+ "timeout_ms": 10000
15
+ },
16
+ "auth": {
17
+ "type": "bearer",
18
+ "token_env": "QWEN_API_KEY"
19
+ },
20
+ "payload_format": "openai_style",
21
+ "api_families": [
22
+ "chat_completions",
23
+ "completions"
24
+ ],
25
+ "default_api_family": "chat_completions",
26
+ "endpoints": {
27
+ "chat": {
28
+ "path": "/chat/completions",
29
+ "method": "POST",
30
+ "adapter": "openai"
31
+ },
32
+ "completions": {
33
+ "path": "/completions",
34
+ "method": "POST",
35
+ "adapter": "openai"
36
+ }
37
+ },
38
+ "services": {
39
+ "list_models": {
40
+ "path": "/models",
41
+ "method": "GET",
42
+ "response_binding": "data"
43
+ }
44
+ },
45
+ "termination": {
46
+ "source_field": "finish_reason",
47
+ "mapping": {
48
+ "stop": "end_turn",
49
+ "length": "max_tokens",
50
+ "tool_calls": "tool_use",
51
+ "content_filter": "refusal"
52
+ },
53
+ "notes": [
54
+ "OpenAI-compatible: finish_reason is reported per candidate."
55
+ ]
56
+ },
57
+ "tooling": {
58
+ "source_model": "openai_tool_calls",
59
+ "tool_use": {
60
+ "id_path": "id",
61
+ "name_path": "function.name",
62
+ "input_path": "function.arguments",
63
+ "input_format": "json_string"
64
+ },
65
+ "notes": [
66
+ "OpenAI-compatible tool_calls.function.arguments is typically a JSON string; runtimes SHOULD parse it into an object when normalizing."
67
+ ]
68
+ },
69
+ "rate_limit_headers": {
70
+ "requests_limit": "x-ratelimit-limit-requests",
71
+ "tokens_limit": "x-ratelimit-limit-tokens",
72
+ "requests_remaining": "x-ratelimit-remaining-requests",
73
+ "tokens_remaining": "x-ratelimit-remaining-tokens",
74
+ "requests_reset": "x-ratelimit-reset-requests",
75
+ "tokens_reset": "x-ratelimit-reset-tokens",
76
+ "retry_after": "retry-after"
77
+ },
78
+ "retry_policy": {
79
+ "strategy": "exponential_backoff",
80
+ "max_retries": 2,
81
+ "min_delay_ms": 1000,
82
+ "max_delay_ms": 8000,
83
+ "jitter": "full",
84
+ "retry_on_http_status": [
85
+ 408,
86
+ 409,
87
+ 429,
88
+ 500,
89
+ 503
90
+ ],
91
+ "notes": [
92
+ "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.",
93
+ "On 429, runtimes SHOULD respect Retry-After when present.",
94
+ "500/503 are server-side/transient; retry after a brief wait.",
95
+ "408/409 are commonly retried by client libraries with short exponential backoff."
96
+ ]
97
+ },
98
+ "error_classification": {
99
+ "by_http_status": {
100
+ "400": "invalid_request",
101
+ "401": "authentication",
102
+ "429": "rate_limited",
103
+ "500": "server_error",
104
+ "503": "overloaded"
105
+ },
106
+ "notes": [
107
+ "Qwen/DashScope 429 may indicate quota/payment issue; runtimes SHOULD treat as quota_exhausted when the message indicates quota/payment."
108
+ ]
109
+ },
110
+ "parameter_mappings": {
111
+ "temperature": "temperature",
112
+ "max_tokens": "max_tokens",
113
+ "stream": "stream",
114
+ "top_p": "top_p",
115
+ "stop_sequences": "stop",
116
+ "tools": "tools",
117
+ "tool_choice": "tool_choice"
118
+ },
119
+ "response_format": "openai_style",
120
+ "response_paths": {
121
+ "content": "choices[0].message.content",
122
+ "tool_calls": "choices[0].message.tool_calls",
123
+ "usage": "usage",
124
+ "finish_reason": "choices[0].finish_reason"
125
+ },
126
+ "streaming": {
127
+ "event_format": "data_lines",
128
+ "decoder": {
129
+ "format": "sse",
130
+ "delimiter": "\n\n",
131
+ "prefix": "data: ",
132
+ "done_signal": "[DONE]"
133
+ },
134
+ "content_path": "choices[0].delta.content",
135
+ "tool_call_path": "choices[0].delta.tool_calls",
136
+ "usage_path": "usage",
137
+ "frame_selector": "exists($.choices) || exists($.error)",
138
+ "event_map": [
139
+ {
140
+ "match": "exists($.choices[*].delta.content)",
141
+ "emit": "PartialContentDelta",
142
+ "fields": {
143
+ "content": "$.choices[*].delta.content"
144
+ }
145
+ },
146
+ {
147
+ "match": "exists($.choices[*].delta.tool_calls[*].function.name)",
148
+ "emit": "ToolCallStarted",
149
+ "fields": {
150
+ "tool_call_id": "$.choices[*].delta.tool_calls[*].id",
151
+ "tool_name": "$.choices[*].delta.tool_calls[*].function.name",
152
+ "index": "$.choices[*].delta.tool_calls[*].index"
153
+ }
154
+ },
155
+ {
156
+ "match": "exists($.choices[*].delta.tool_calls[*].function.arguments)",
157
+ "emit": "PartialToolCall",
158
+ "fields": {
159
+ "arguments": "$.choices[*].delta.tool_calls[*].function.arguments",
160
+ "index": "$.choices[*].delta.tool_calls[*].index"
161
+ }
162
+ },
163
+ {
164
+ "match": "exists($.usage)",
165
+ "emit": "Metadata",
166
+ "fields": {
167
+ "usage": "$.usage"
168
+ }
169
+ },
170
+ {
171
+ "match": "exists($.choices[*].finish_reason)",
172
+ "emit": "FinalCandidate",
173
+ "fields": {
174
+ "finish_reason": "$.choices[*].finish_reason",
175
+ "candidate_index": "$.choices[*].index"
176
+ }
177
+ }
178
+ ],
179
+ "stop_condition": "$.choices[0].finish_reason != null"
180
+ },
181
+ "features": {
182
+ "multi_candidate": {
183
+ "support_type": "native",
184
+ "param_name": "n"
185
+ },
186
+ "response_mapping": {
187
+ "tool_calls": {
188
+ "path": "choices[0].message.tool_calls",
189
+ "fields": {
190
+ "id": "id",
191
+ "name": "function.name",
192
+ "args": "function.arguments"
193
+ }
194
+ },
195
+ "error": {
196
+ "message_path": "error.message",
197
+ "code_path": "error.code",
198
+ "type_path": "error.type",
199
+ "param_path": "error.param"
200
+ }
201
+ }
202
+ },
203
+ "capabilities": {
204
+ "streaming": true,
205
+ "tools": true,
206
+ "vision": true,
207
+ "agentic": true,
208
+ "parallel_tools": false,
209
+ "reasoning": false
210
+ },
211
+ "availability": {
212
+ "required": false,
213
+ "regions": [
214
+ "cn",
215
+ "global"
216
+ ],
217
+ "check": {
218
+ "method": "GET",
219
+ "path": "/models",
220
+ "expected_status": [
221
+ 200,
222
+ 401
223
+ ],
224
+ "timeout_ms": 3000
225
+ }
226
+ },
227
+ "experimental_features": [
228
+ "multilingual_support",
229
+ "qwen_agent"
230
+ ]
231
+ }
@@ -0,0 +1,192 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json",
3
+ "id": "replicate",
4
+ "protocol_version": "1.5",
5
+ "name": "Replicate",
6
+ "version": "v1",
7
+ "status": "stable",
8
+ "category": "model_provider",
9
+ "official_url": "https://replicate.com/docs",
10
+ "support_contact": "https://replicate.com/contact",
11
+ "endpoint": {
12
+ "base_url": "https://api.replicate.com/v1",
13
+ "protocol": "https",
14
+ "timeout_ms": 60000
15
+ },
16
+ "auth": {
17
+ "type": "bearer",
18
+ "token_env": "REPLICATE_API_TOKEN"
19
+ },
20
+ "payload_format": "replicate_style",
21
+ "api_families": [
22
+ "predictions",
23
+ "openai_compatible"
24
+ ],
25
+ "default_api_family": "predictions",
26
+ "endpoints": {
27
+ "chat": {
28
+ "path": "/models/{owner}/{model}/predictions",
29
+ "method": "POST",
30
+ "adapter": "replicate"
31
+ },
32
+ "openai_chat": {
33
+ "path": "/openai/v1/chat/completions",
34
+ "method": "POST",
35
+ "adapter": "openai"
36
+ }
37
+ },
38
+ "services": {
39
+ "list_models": {
40
+ "path": "/models",
41
+ "method": "GET",
42
+ "response_binding": "results"
43
+ },
44
+ "get_prediction": {
45
+ "path": "/predictions/{id}",
46
+ "method": "GET"
47
+ },
48
+ "cancel_prediction": {
49
+ "path": "/predictions/{id}/cancel",
50
+ "method": "POST"
51
+ }
52
+ },
53
+ "termination": {
54
+ "source_field": "status",
55
+ "mapping": {
56
+ "succeeded": "end_turn",
57
+ "failed": "other",
58
+ "canceled": "cancelled"
59
+ },
60
+ "notes": [
61
+ "Replicate uses async predictions with status polling.",
62
+ "For streaming, use the stream parameter."
63
+ ]
64
+ },
65
+ "tooling": {
66
+ "source_model": "unknown",
67
+ "notes": [
68
+ "Tool calling support varies by model.",
69
+ "Some models support OpenAI-compatible function calling via the openai endpoint."
70
+ ]
71
+ },
72
+ "retry_policy": {
73
+ "strategy": "exponential_backoff",
74
+ "max_retries": 3,
75
+ "min_delay_ms": 1000,
76
+ "max_delay_ms": 30000,
77
+ "jitter": "full",
78
+ "retry_on_http_status": [
79
+ 429,
80
+ 500,
81
+ 502,
82
+ 503,
83
+ 504
84
+ ],
85
+ "notes": [
86
+ "Replicate may return 503 when models are cold-starting.",
87
+ "Consider longer timeouts for initial requests."
88
+ ]
89
+ },
90
+ "error_classification": {
91
+ "by_http_status": {
92
+ "400": "invalid_request",
93
+ "401": "authentication",
94
+ "402": "quota_exhausted",
95
+ "403": "permission_denied",
96
+ "404": "not_found",
97
+ "422": "invalid_request",
98
+ "429": "rate_limited",
99
+ "500": "server_error",
100
+ "503": "overloaded"
101
+ }
102
+ },
103
+ "parameter_mappings": {
104
+ "temperature": "input.temperature",
105
+ "max_tokens": "input.max_tokens",
106
+ "stream": "stream",
107
+ "top_p": "input.top_p",
108
+ "stop_sequences": "input.stop",
109
+ "prompt": "input.prompt",
110
+ "system_message": "input.system_prompt"
111
+ },
112
+ "response_format": "replicate_style",
113
+ "response_paths": {
114
+ "content": "output",
115
+ "status": "status",
116
+ "error": "error"
117
+ },
118
+ "streaming": {
119
+ "event_format": "sse",
120
+ "decoder": {
121
+ "format": "sse",
122
+ "delimiter": "\n\n",
123
+ "prefix": "data: ",
124
+ "done_signal": "done"
125
+ },
126
+ "content_path": "output",
127
+ "event_map": [
128
+ {
129
+ "match": "$.event == 'output'",
130
+ "emit": "PartialContentDelta",
131
+ "fields": {
132
+ "content": "$.data"
133
+ }
134
+ },
135
+ {
136
+ "match": "$.event == 'done'",
137
+ "emit": "StreamEnd",
138
+ "fields": {
139
+ "finish_reason": "end_turn"
140
+ }
141
+ },
142
+ {
143
+ "match": "$.event == 'error'",
144
+ "emit": "StreamError",
145
+ "fields": {
146
+ "error": "$.data"
147
+ }
148
+ }
149
+ ],
150
+ "stop_condition": "$.event == 'done'"
151
+ },
152
+ "features": {
153
+ "multi_candidate": {
154
+ "support_type": "simulated",
155
+ "max_concurrent": 4
156
+ },
157
+ "response_mapping": {
158
+ "error": {
159
+ "message_path": "detail",
160
+ "type_path": "type"
161
+ }
162
+ }
163
+ },
164
+ "capabilities": {
165
+ "streaming": true,
166
+ "tools": false,
167
+ "vision": true,
168
+ "agentic": false,
169
+ "parallel_tools": false,
170
+ "reasoning": false
171
+ },
172
+ "availability": {
173
+ "required": false,
174
+ "regions": [
175
+ "global"
176
+ ],
177
+ "check": {
178
+ "method": "GET",
179
+ "path": "/models",
180
+ "expected_status": [
181
+ 200,
182
+ 401
183
+ ],
184
+ "timeout_ms": 5000
185
+ }
186
+ },
187
+ "experimental_features": [
188
+ "async_predictions",
189
+ "webhooks",
190
+ "cold_boot_optimization"
191
+ ]
192
+ }