@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,163 @@
1
+ $schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
2
+ protocol_version: "1.1"
3
+
4
+ # 智谱 AI (Zhipu/GLM) Model Instances
5
+ #
6
+ # VERIFIED_AT: 2026-01-31 (based on public Zhipu documentation)
7
+ #
8
+ # Notes:
9
+ # - GLM (General Language Model) is Zhipu's flagship model series.
10
+ # - Founded by Tsinghua University researchers.
11
+ # - Known for strong Chinese language capabilities.
12
+
13
+ models:
14
+ # GLM-4 series (latest)
15
+ glm-4-plus:
16
+ provider: zhipu
17
+ model_id: "glm-4-plus"
18
+ display_name: "GLM-4 Plus"
19
+ verification:
20
+ status: unverified
21
+ verified_at: "2026-01-31"
22
+ source: "documentation"
23
+ notes: "Latest flagship model with best performance."
24
+ context_window: 131072
25
+ capabilities: [chat, tools, streaming]
26
+ status: active
27
+ tags: ["zhipu", "glm", "flagship", "cn"]
28
+ pricing:
29
+ input_per_token: 0.00005
30
+ output_per_token: 0.00005
31
+
32
+ glm-4-0520:
33
+ provider: zhipu
34
+ model_id: "glm-4-0520"
35
+ display_name: "GLM-4 0520"
36
+ verification:
37
+ status: unverified
38
+ verified_at: "2026-01-31"
39
+ source: "documentation"
40
+ context_window: 131072
41
+ capabilities: [chat, tools, streaming]
42
+ status: active
43
+ tags: ["zhipu", "glm", "cn"]
44
+ pricing:
45
+ input_per_token: 0.0001
46
+ output_per_token: 0.0001
47
+
48
+ glm-4-air:
49
+ provider: zhipu
50
+ model_id: "glm-4-air"
51
+ display_name: "GLM-4 Air"
52
+ verification:
53
+ status: unverified
54
+ verified_at: "2026-01-31"
55
+ source: "documentation"
56
+ notes: "Cost-effective model with good performance."
57
+ context_window: 131072
58
+ capabilities: [chat, tools, streaming]
59
+ status: active
60
+ tags: ["zhipu", "glm", "cost_effective", "cn"]
61
+ pricing:
62
+ input_per_token: 0.000001
63
+ output_per_token: 0.000001
64
+
65
+ glm-4-airx:
66
+ provider: zhipu
67
+ model_id: "glm-4-airx"
68
+ display_name: "GLM-4 AirX"
69
+ verification:
70
+ status: unverified
71
+ verified_at: "2026-01-31"
72
+ source: "documentation"
73
+ notes: "Fast inference version of GLM-4 Air."
74
+ context_window: 8192
75
+ capabilities: [chat, tools, streaming]
76
+ status: active
77
+ tags: ["zhipu", "glm", "fast", "cn"]
78
+ pricing:
79
+ input_per_token: 0.00001
80
+ output_per_token: 0.00001
81
+
82
+ glm-4-flash:
83
+ provider: zhipu
84
+ model_id: "glm-4-flash"
85
+ display_name: "GLM-4 Flash"
86
+ verification:
87
+ status: unverified
88
+ verified_at: "2026-01-31"
89
+ source: "documentation"
90
+ notes: "Free tier model with rate limits."
91
+ context_window: 131072
92
+ capabilities: [chat, tools, streaming]
93
+ status: active
94
+ tags: ["zhipu", "glm", "free_tier", "cn"]
95
+ pricing:
96
+ input_per_token: 0
97
+ output_per_token: 0
98
+
99
+ glm-4-long:
100
+ provider: zhipu
101
+ model_id: "glm-4-long"
102
+ display_name: "GLM-4 Long"
103
+ verification:
104
+ status: unverified
105
+ verified_at: "2026-01-31"
106
+ source: "documentation"
107
+ context_window: 1048576
108
+ capabilities: [chat, streaming]
109
+ status: active
110
+ tags: ["zhipu", "glm", "ultra_long_context", "cn"]
111
+ pricing:
112
+ input_per_token: 0.000001
113
+ output_per_token: 0.000001
114
+
115
+ # GLM-4V Vision model
116
+ glm-4v-plus:
117
+ provider: zhipu
118
+ model_id: "glm-4v-plus"
119
+ display_name: "GLM-4V Plus"
120
+ verification:
121
+ status: unverified
122
+ verified_at: "2026-01-31"
123
+ source: "documentation"
124
+ context_window: 8192
125
+ capabilities: [chat, vision, streaming]
126
+ status: active
127
+ tags: ["zhipu", "glm", "vision", "multimodal", "cn"]
128
+ pricing:
129
+ input_per_token: 0.00001
130
+ output_per_token: 0.00001
131
+
132
+ glm-4v:
133
+ provider: zhipu
134
+ model_id: "glm-4v"
135
+ display_name: "GLM-4V"
136
+ verification:
137
+ status: unverified
138
+ verified_at: "2026-01-31"
139
+ source: "documentation"
140
+ context_window: 2048
141
+ capabilities: [chat, vision, streaming]
142
+ status: active
143
+ tags: ["zhipu", "glm", "vision", "multimodal", "cn"]
144
+ pricing:
145
+ input_per_token: 0.00005
146
+ output_per_token: 0.00005
147
+
148
+ # Embedding model
149
+ embedding-3:
150
+ provider: zhipu
151
+ model_id: "embedding-3"
152
+ display_name: "Zhipu Embedding 3"
153
+ verification:
154
+ status: unverified
155
+ verified_at: "2026-01-31"
156
+ source: "documentation"
157
+ context_window: 8192
158
+ capabilities: [embedding]
159
+ status: active
160
+ tags: ["zhipu", "embedding", "cn"]
161
+ pricing:
162
+ input_per_token: 0.0000005
163
+ output_per_token: 0
@@ -0,0 +1,176 @@
1
+ $schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
2
+
3
+ id: ai21
4
+ protocol_version: "1.5"
5
+
6
+ name: AI21 Labs
7
+ version: "v1"
8
+ status: stable
9
+ category: ai_provider
10
+ official_url: "https://docs.ai21.com"
11
+ support_contact: "https://www.ai21.com/contact"
12
+
13
+ endpoint:
14
+ base_url: "https://api.ai21.com/studio/v1"
15
+ protocol: https
16
+ timeout_ms: 30000
17
+
18
+ auth:
19
+ type: bearer
20
+ token_env: "AI21_API_KEY"
21
+
22
+ payload_format: "ai21_style"
23
+
24
+ # AI21 supports both native and chat endpoints
25
+ api_families: ["chat", "complete"]
26
+ default_api_family: "chat"
27
+
28
+ endpoints:
29
+ chat:
30
+ path: "/chat/completions"
31
+ method: "POST"
32
+ adapter: "ai21_chat"
33
+ # Jamba models use a different endpoint
34
+ jamba_chat:
35
+ path: "/jamba-1.5-large/chat/completions"
36
+ method: "POST"
37
+ adapter: "openai"
38
+
39
+ services:
40
+ list_models:
41
+ path: "/models"
42
+ method: "GET"
43
+
44
+ termination:
45
+ source_field: "finish_reason"
46
+ mapping:
47
+ stop: "end_turn"
48
+ length: "max_tokens"
49
+ endoftext: "end_turn"
50
+ notes:
51
+ - "AI21 uses finish_reason similar to OpenAI."
52
+ - "Jamba models follow OpenAI-compatible format."
53
+
54
+ tooling:
55
+ source_model: "openai_tool_calls"
56
+ tool_use:
57
+ id_path: "id"
58
+ name_path: "function.name"
59
+ input_path: "function.arguments"
60
+ input_format: "json_string"
61
+ notes:
62
+ - "Jamba models support function calling in OpenAI format."
63
+
64
+ retry_policy:
65
+ strategy: "exponential_backoff"
66
+ max_retries: 3
67
+ min_delay_ms: 1000
68
+ max_delay_ms: 30000
69
+ jitter: "full"
70
+ retry_on_http_status: [429, 500, 502, 503]
71
+ notes:
72
+ - "AI21 uses standard rate limiting."
73
+
74
+ error_classification:
75
+ by_http_status:
76
+ "400": "invalid_request"
77
+ "401": "authentication"
78
+ "403": "permission_denied"
79
+ "404": "not_found"
80
+ "422": "invalid_request"
81
+ "429": "rate_limited"
82
+ "500": "server_error"
83
+ "503": "overloaded"
84
+
85
+ parameter_mappings:
86
+ temperature: "temperature"
87
+ max_tokens: "max_tokens"
88
+ stream: "stream"
89
+ top_p: "top_p"
90
+ stop_sequences: "stop"
91
+ tools: "tools"
92
+ tool_choice: "tool_choice"
93
+ n: "n"
94
+
95
+ response_format: "ai21_style"
96
+
97
+ response_paths:
98
+ content: "choices[0].message.content"
99
+ tool_calls: "choices[0].message.tool_calls"
100
+ usage: "usage"
101
+ finish_reason: "choices[0].finish_reason"
102
+
103
+ streaming:
104
+ event_format: "sse"
105
+ decoder:
106
+ format: "sse"
107
+ delimiter: "\n\n"
108
+ prefix: "data: "
109
+ done_signal: "[DONE]"
110
+ content_path: "choices[0].delta.content"
111
+ tool_call_path: "choices[0].delta.tool_calls"
112
+ usage_path: "usage"
113
+ frame_selector: "exists($.choices) || exists($.error)"
114
+ event_map:
115
+ - match: "exists($.choices[*].delta.content)"
116
+ emit: "PartialContentDelta"
117
+ fields:
118
+ content: "$.choices[*].delta.content"
119
+ - match: "exists($.choices[*].delta.tool_calls[*].function.name)"
120
+ emit: "ToolCallStarted"
121
+ fields:
122
+ tool_call_id: "$.choices[*].delta.tool_calls[*].id"
123
+ tool_name: "$.choices[*].delta.tool_calls[*].function.name"
124
+ index: "$.choices[*].delta.tool_calls[*].index"
125
+ - match: "exists($.choices[*].delta.tool_calls[*].function.arguments)"
126
+ emit: "PartialToolCall"
127
+ fields:
128
+ arguments: "$.choices[*].delta.tool_calls[*].function.arguments"
129
+ index: "$.choices[*].delta.tool_calls[*].index"
130
+ - match: "exists($.usage)"
131
+ emit: "Metadata"
132
+ fields:
133
+ usage: "$.usage"
134
+ - match: "exists($.choices[*].finish_reason)"
135
+ emit: "FinalCandidate"
136
+ fields:
137
+ finish_reason: "$.choices[*].finish_reason"
138
+ stop_condition: "$.choices[0].finish_reason != null"
139
+
140
+ features:
141
+ multi_candidate:
142
+ support_type: "native"
143
+ param_name: "n"
144
+ response_mapping:
145
+ tool_calls:
146
+ path: "choices[0].message.tool_calls"
147
+ fields:
148
+ id: "id"
149
+ name: "function.name"
150
+ args: "function.arguments"
151
+ error:
152
+ message_path: "detail"
153
+ type_path: "type"
154
+
155
+ capabilities:
156
+ streaming: true
157
+ tools: true
158
+ vision: false
159
+ agentic: true
160
+ parallel_tools: false
161
+ reasoning: false
162
+
163
+ availability:
164
+ required: false
165
+ regions:
166
+ - global
167
+ check:
168
+ method: GET
169
+ path: "/models"
170
+ expected_status: [200, 401]
171
+ timeout_ms: 5000
172
+
173
+ experimental_features:
174
+ - "contextual_answers"
175
+ - "summarization"
176
+ - "paraphrase"
@@ -0,0 +1,209 @@
1
+ $schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
2
+
3
+ id: anthropic
4
+ protocol_version: "1.5"
5
+
6
+ name: Anthropic
7
+ version: "v1"
8
+ status: stable
9
+ category: ai_provider
10
+ official_url: "https://docs.anthropic.com"
11
+ support_contact: "https://support.anthropic.com"
12
+
13
+ # Structured endpoint definition (v1.1+ extension)
14
+ endpoint:
15
+ base_url: "https://api.anthropic.com/v1"
16
+ protocol: https
17
+ timeout_ms: 10000
18
+
19
+ auth:
20
+ type: bearer
21
+ token_env: "ANTHROPIC_API_KEY"
22
+ extra_headers:
23
+ - name: "anthropic-version"
24
+ value: "2023-06-01"
25
+ payload_format: "anthropic_style"
26
+
27
+ # Rate limits (VERIFIED evidence in research/providers/anthropic.md: rate limits + retry-after)
28
+ rate_limit_headers:
29
+ retry_after: "retry-after"
30
+ requests_limit: "anthropic-ratelimit-requests-limit"
31
+ requests_remaining: "anthropic-ratelimit-requests-remaining"
32
+ requests_reset: "anthropic-ratelimit-requests-reset"
33
+ tokens_limit: "anthropic-ratelimit-tokens-limit"
34
+ tokens_remaining: "anthropic-ratelimit-tokens-remaining"
35
+ tokens_reset: "anthropic-ratelimit-tokens-reset"
36
+
37
+ # Retry policy (VERIFIED evidence in research/providers/anthropic.md: SDK retry behavior + docs retry-after)
38
+ retry_policy:
39
+ strategy: "exponential_backoff"
40
+ max_retries: 2
41
+ max_delay_ms: 60000
42
+ min_delay_ms: 1000
43
+ jitter: "full"
44
+ retry_on_http_status: [408, 409, 429, 500, 529]
45
+ notes:
46
+ - "On 429, Anthropic returns a retry-after header (seconds) indicating how long to wait."
47
+ - "SDKs commonly auto-retry certain errors 2 times with a short exponential backoff (429 and >=500 among others)."
48
+
49
+ # Error classification hints (see v1/spec.yaml: standard_schema.error_handling.error_classes)
50
+ error_classification:
51
+ by_http_status:
52
+ "400": "invalid_request"
53
+ "401": "authentication"
54
+ "403": "permission_denied"
55
+ "404": "not_found"
56
+ "413": "request_too_large"
57
+ "429": "rate_limited"
58
+ "500": "server_error"
59
+ "529": "overloaded"
60
+ notes:
61
+ - "Anthropic uses error.type values (e.g., rate_limit_error, overloaded_error); runtimes SHOULD preserve error.type as raw metadata."
62
+
63
+ # Anthropic native API families
64
+ api_families: ["messages"]
65
+ default_api_family: "messages"
66
+ endpoints:
67
+ chat:
68
+ path: "/messages"
69
+ method: "POST"
70
+ adapter: "anthropic"
71
+
72
+ # V1.5 Service Endpoints
73
+ services:
74
+ list_models:
75
+ path: "/models"
76
+ method: "GET"
77
+ response_binding: "data"
78
+ get_usage_report:
79
+ path: "/organizations/usage_report/messages"
80
+ method: "POST"
81
+ headers:
82
+ "anthropic-beta": "message-batches-2024-09-24"
83
+
84
+ # Termination reason normalization (see v1/spec.yaml: standard_schema.streaming_events.termination_reasons)
85
+ termination:
86
+ source_field: "stop_reason"
87
+ mapping:
88
+ end_turn: "end_turn"
89
+ max_tokens: "max_tokens"
90
+ stop_sequence: "stop_sequence"
91
+ tool_use: "tool_use"
92
+ pause_turn: "pause_turn"
93
+ refusal: "refusal"
94
+ notes:
95
+ - "Non-streaming: stop_reason is always non-null."
96
+ - "Streaming: stop_reason is null in message_start, then non-null otherwise."
97
+ parameter_mappings:
98
+ temperature: "temperature"
99
+ max_tokens: "max_tokens"
100
+ stream: "stream"
101
+ top_p: "top_p"
102
+ stop_sequences: "stop_sequences"
103
+ tools: "tools"
104
+ tool_choice: "tool_choice"
105
+ system_message: "system"
106
+ reasoning_effort: "reasoning_effort"
107
+ response_format: "anthropic_style"
108
+ response_paths:
109
+ content: "content[0].text"
110
+ tool_calls: "content[0].tool_calls"
111
+ usage: "usage"
112
+ stop_reason: "stop_reason"
113
+ streaming:
114
+ event_format: "anthropic_sse"
115
+ decoder:
116
+ format: "anthropic_sse"
117
+ strategy: "anthropic_event_stream"
118
+ delimiter: "\n\n"
119
+ prefix: "data: "
120
+ done_signal: "[DONE]"
121
+ # Official event flow includes message_start and may include ping events.
122
+ frame_selector: "$.type in ['message_start', 'content_block_start', 'content_block_delta', 'content_block_stop', 'message_delta', 'message_stop', 'ping']"
123
+ accumulator:
124
+ stateful_tool_parsing: true
125
+ key_path: "$.delta.partial_json"
126
+ flush_on: "$.type == 'content_block_stop'"
127
+ event_map:
128
+ # Text content streaming
129
+ - match: "$.type == 'content_block_delta' && $.delta.type == 'text_delta'"
130
+ emit: "PartialContentDelta"
131
+ fields:
132
+ content: "$.delta.text"
133
+ # Thinking/reasoning delta (Claude 3.5+ extended thinking)
134
+ - match: "$.type == 'content_block_delta' && $.delta.type == 'thinking_delta'"
135
+ emit: "ThinkingDelta"
136
+ fields:
137
+ thinking: "$.delta.thinking"
138
+ # Tool call start (for multi-tool scenarios)
139
+ - match: "$.type == 'content_block_start' && $.content_block.type == 'tool_use'"
140
+ emit: "ToolCallStarted"
141
+ fields:
142
+ tool_call_id: "$.content_block.id"
143
+ tool_name: "$.content_block.name"
144
+ index: "$.index"
145
+ # Tool call arguments streaming
146
+ - match: "$.type == 'content_block_delta' && $.delta.type == 'input_json_delta'"
147
+ emit: "PartialToolCall"
148
+ fields:
149
+ arguments: "$.delta.partial_json"
150
+ index: "$.index"
151
+ # Tool call end
152
+ - match: "$.type == 'content_block_stop'"
153
+ emit: "ToolCallEnded"
154
+ fields:
155
+ index: "$.index"
156
+ # Message delta with usage and stop_reason
157
+ - match: "$.type == 'message_delta'"
158
+ emit: "Metadata"
159
+ fields:
160
+ stop_reason: "$.delta.stop_reason"
161
+ usage: "$.usage"
162
+ # Stream end
163
+ - match: "$.type == 'message_stop'"
164
+ emit: "StreamEnd"
165
+ fields:
166
+ finish_reason: "end_turn"
167
+ stop_condition: "$.type == 'message_stop'"
168
+ extra_metadata_path: "$.usage"
169
+ content_path: "delta.text"
170
+ tool_call_path: "delta.tool_calls"
171
+ features:
172
+ multi_candidate:
173
+ support_type: "simulated"
174
+ max_concurrent: 4
175
+ response_mapping:
176
+ tool_calls:
177
+ path: "content"
178
+ filter: "type == 'tool_use'"
179
+ fields:
180
+ id: "id"
181
+ name: "name"
182
+ args: "input"
183
+ id_strategy: "path"
184
+ array_fan_out: true
185
+ error:
186
+ message_path: "error.message"
187
+ code_path: "error.type"
188
+ request_id_path: "request_id"
189
+ capabilities:
190
+ streaming: true
191
+ tools: true
192
+ vision: true
193
+ agentic: true
194
+ parallel_tools: false
195
+ reasoning: true
196
+ experimental_features:
197
+ - "thinking_blocks"
198
+ - "mcp"
199
+
200
+ # Availability and health checking (v1.1+ extension)
201
+ availability:
202
+ required: false
203
+ regions:
204
+ - global
205
+ check:
206
+ method: GET
207
+ path: "/models"
208
+ expected_status: [200, 401]
209
+ timeout_ms: 3000
@@ -0,0 +1,106 @@
1
+ $schema: ../../schemas/v1.json
2
+ protocol_version: "1.5"
3
+ id: "anyscale"
4
+ name: "Anyscale"
5
+ status: "stable"
6
+ category: "model_provider"
7
+ official_url: "https://www.anyscale.com/"
8
+ support_contact: "https://www.anyscale.com/contact"
9
+
10
+ endpoint:
11
+ base_url: "https://api.anyscale.com/v1"
12
+ protocol: "https"
13
+ timeout_ms: 60000
14
+
15
+ auth:
16
+ type: bearer
17
+ token_env: "ANYSCALE_API_TOKEN"
18
+ payload_format: "openai_style"
19
+
20
+ services:
21
+ list_models:
22
+ path: "/models"
23
+ method: "GET"
24
+ response_binding: "data"
25
+
26
+ availability:
27
+ required: false
28
+ regions: ["global"]
29
+ check:
30
+ method: "GET"
31
+ path: "/models"
32
+ expected_status: [200]
33
+
34
+ capabilities:
35
+ streaming: true
36
+ tools: true
37
+ vision: false
38
+ agentic: false
39
+ reasoning: false
40
+ parallel_tools: false
41
+
42
+ # Anyscale is OpenAI-compatible
43
+ streaming:
44
+ event_format: "data_lines"
45
+ decoder:
46
+ format: "sse"
47
+ delimiter: "\n\n"
48
+ prefix: "data: "
49
+ done_signal: "[DONE]"
50
+
51
+ response_format: "openai_style"
52
+ response_paths:
53
+ content: "choices.0.message.content"
54
+ finish_reason: "choices.0.finish_reason"
55
+ model: "model"
56
+ id: "id"
57
+ created: "created"
58
+
59
+ # Stream event normalization moved to streaming.event_map (v1/spec.yaml)
60
+ # event_map is defined in the streaming section below
61
+ # Error response mapping (see v1/spec.yaml)
62
+ error_classification:
63
+ by_http_status:
64
+ "400": "invalid_request"
65
+ "401": "authentication"
66
+ "403": "permission_denied"
67
+ "404": "not_found"
68
+ "409": "conflict"
69
+ "429": "rate_limited"
70
+ "500": "server_error"
71
+ "502": "server_error"
72
+ "503": "server_error"
73
+ "504": "timeout"
74
+
75
+ # Retry policy (standard template)
76
+ retry_policy:
77
+ max_retries: 3
78
+ max_delay_ms: 30000
79
+ strategy: "exponential_backoff"
80
+ min_delay_ms: 1000
81
+ jitter: "full"
82
+ retry_on_http_status: [429, 500, 502, 503]
83
+
84
+ rate_limit_headers:
85
+ requests_limit: "x-ratelimit-limit-requests"
86
+ requests_remaining: "x-ratelimit-remaining-requests"
87
+ tokens_limit: "x-ratelimit-limit-tokens"
88
+ tokens_remaining: "x-ratelimit-remaining-tokens"
89
+
90
+ # Parameter mappings for chat completions
91
+ parameter_mappings:
92
+ model: "model"
93
+ messages: "messages"
94
+ temperature: "temperature"
95
+ max_tokens: "max_tokens"
96
+ top_p: "top_p"
97
+ frequency_penalty: "frequency_penalty"
98
+ presence_penalty: "presence_penalty"
99
+ stop: "stop"
100
+ stream: "stream"
101
+
102
+ notes:
103
+ - "Anyscale provides Ray-based model serving infrastructure"
104
+ - "OpenAI-compatible API with multiple model options"
105
+ - "Supports various LLMs including Llama, Mistral, and others"
106
+ - "Enterprise-grade model serving platform"