@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.
- package/LICENSE +6 -0
- package/README.md +415 -0
- package/dist/index.json +8 -0
- package/dist/v1/models/ai21.json +140 -0
- package/dist/v1/models/baichuan.json +138 -0
- package/dist/v1/models/cerebras.json +147 -0
- package/dist/v1/models/claude.json +114 -0
- package/dist/v1/models/cohere.json +235 -0
- package/dist/v1/models/deepinfra.json +43 -0
- package/dist/v1/models/deepseek-chat.json +55 -0
- package/dist/v1/models/doubao.json +197 -0
- package/dist/v1/models/ernie.json +223 -0
- package/dist/v1/models/fireworks.json +222 -0
- package/dist/v1/models/gemini.json +58 -0
- package/dist/v1/models/gpt.json +166 -0
- package/dist/v1/models/grok.json +138 -0
- package/dist/v1/models/huggingface.json +183 -0
- package/dist/v1/models/hunyuan.json +255 -0
- package/dist/v1/models/jina.json +139 -0
- package/dist/v1/models/lepton.json +188 -0
- package/dist/v1/models/llama.json +143 -0
- package/dist/v1/models/minimax.json +194 -0
- package/dist/v1/models/mistral.json +177 -0
- package/dist/v1/models/moonshot.json +144 -0
- package/dist/v1/models/nvidia.json +212 -0
- package/dist/v1/models/palmyra.json +103 -0
- package/dist/v1/models/perplexity.json +143 -0
- package/dist/v1/models/qwen.json +49 -0
- package/dist/v1/models/replicate.json +206 -0
- package/dist/v1/models/sensenova.json +144 -0
- package/dist/v1/models/siliconflow.json +44 -0
- package/dist/v1/models/spark.json +173 -0
- package/dist/v1/models/stable-diffusion.json +161 -0
- package/dist/v1/models/tiangong.json +169 -0
- package/dist/v1/models/together.json +43 -0
- package/dist/v1/models/yi.json +199 -0
- package/dist/v1/models/zhipu.json +250 -0
- package/dist/v1/providers/ai21.json +215 -0
- package/dist/v1/providers/anthropic.json +253 -0
- package/dist/v1/providers/anyscale.json +115 -0
- package/dist/v1/providers/azure.json +188 -0
- package/dist/v1/providers/baichuan.json +205 -0
- package/dist/v1/providers/baidu.json +205 -0
- package/dist/v1/providers/cerebras.json +216 -0
- package/dist/v1/providers/cohere.json +209 -0
- package/dist/v1/providers/deepinfra.json +196 -0
- package/dist/v1/providers/deepseek.json +221 -0
- package/dist/v1/providers/doubao.json +209 -0
- package/dist/v1/providers/fireworks.json +227 -0
- package/dist/v1/providers/gemini.json +279 -0
- package/dist/v1/providers/groq.json +218 -0
- package/dist/v1/providers/huggingface.json +181 -0
- package/dist/v1/providers/hunyuan.json +198 -0
- package/dist/v1/providers/jina.json +202 -0
- package/dist/v1/providers/lepton.json +221 -0
- package/dist/v1/providers/minimax.json +209 -0
- package/dist/v1/providers/mistral.json +214 -0
- package/dist/v1/providers/moonshot.json +214 -0
- package/dist/v1/providers/nvidia.json +213 -0
- package/dist/v1/providers/openai.json +267 -0
- package/dist/v1/providers/openrouter.json +220 -0
- package/dist/v1/providers/perplexity.json +172 -0
- package/dist/v1/providers/qwen.json +231 -0
- package/dist/v1/providers/replicate.json +192 -0
- package/dist/v1/providers/sensenova.json +185 -0
- package/dist/v1/providers/siliconflow.json +197 -0
- package/dist/v1/providers/spark.json +204 -0
- package/dist/v1/providers/stability.json +221 -0
- package/dist/v1/providers/tiangong.json +207 -0
- package/dist/v1/providers/together.json +196 -0
- package/dist/v1/providers/writer.json +253 -0
- package/dist/v1/providers/xai.json +238 -0
- package/dist/v1/providers/yi.json +205 -0
- package/dist/v1/providers/zhipu.json +208 -0
- package/dist/v1/spec.json +783 -0
- package/dist/v2/providers/anthropic.json +372 -0
- package/dist/v2/providers/cohere.json +109 -0
- package/dist/v2/providers/deepseek.json +272 -0
- package/dist/v2/providers/doubao.json +260 -0
- package/dist/v2/providers/google.json +388 -0
- package/dist/v2/providers/jina.json +71 -0
- package/dist/v2/providers/moonshot.json +284 -0
- package/dist/v2/providers/openai.json +419 -0
- package/dist/v2/providers/qwen.json +274 -0
- package/dist/v2/providers/zhipu.json +257 -0
- package/dist/v2-alpha/providers/anthropic.json +182 -0
- package/dist/v2-alpha/providers/gemini.json +187 -0
- package/dist/v2-alpha/providers/openai.json +215 -0
- package/dist/v2-alpha/spec.json +644 -0
- package/package.json +61 -0
- package/schemas/spec.json +186 -0
- package/schemas/v1.json +1116 -0
- package/schemas/v2/availability.json +66 -0
- package/schemas/v2/capabilities.json +182 -0
- package/schemas/v2/capability-profile.json +174 -0
- package/schemas/v2/computer-use.json +222 -0
- package/schemas/v2/context-policy.json +148 -0
- package/schemas/v2/endpoint.json +2 -0
- package/schemas/v2/error-codes.yaml +225 -0
- package/schemas/v2/errors.json +250 -0
- package/schemas/v2/execution-metadata.json +59 -0
- package/schemas/v2/mcp.json +225 -0
- package/schemas/v2/message-roles.json +10 -0
- package/schemas/v2/multimodal.json +297 -0
- package/schemas/v2/pricing.json +14 -0
- package/schemas/v2/provider-contract.json +317 -0
- package/schemas/v2/provider.json +203 -0
- package/schemas/v2/regions.json +14 -0
- package/v1/models/ai21.yaml +97 -0
- package/v1/models/baichuan.yaml +95 -0
- package/v1/models/cerebras.yaml +99 -0
- package/v1/models/claude.yaml +59 -0
- package/v1/models/cohere.yaml +165 -0
- package/v1/models/deepinfra.yaml +29 -0
- package/v1/models/deepseek-chat.yaml +32 -0
- package/v1/models/doubao.yaml +129 -0
- package/v1/models/ernie.yaml +146 -0
- package/v1/models/fireworks.yaml +145 -0
- package/v1/models/gemini.yaml +32 -0
- package/v1/models/gpt.yaml +90 -0
- package/v1/models/grok.yaml +74 -0
- package/v1/models/huggingface.yaml +110 -0
- package/v1/models/hunyuan.yaml +164 -0
- package/v1/models/jina.yaml +98 -0
- package/v1/models/lepton.yaml +130 -0
- package/v1/models/llama.yaml +91 -0
- package/v1/models/minimax.yaml +132 -0
- package/v1/models/mistral.yaml +100 -0
- package/v1/models/moonshot.yaml +97 -0
- package/v1/models/nvidia.yaml +118 -0
- package/v1/models/palmyra.yaml +59 -0
- package/v1/models/perplexity.yaml +97 -0
- package/v1/models/qwen.yaml +27 -0
- package/v1/models/replicate.yaml +136 -0
- package/v1/models/sensenova.yaml +97 -0
- package/v1/models/siliconflow.yaml +29 -0
- package/v1/models/spark.yaml +114 -0
- package/v1/models/stable-diffusion.yaml +113 -0
- package/v1/models/tiangong.yaml +114 -0
- package/v1/models/together.yaml +29 -0
- package/v1/models/yi.yaml +132 -0
- package/v1/models/zhipu.yaml +163 -0
- package/v1/providers/ai21.yaml +176 -0
- package/v1/providers/anthropic.yaml +209 -0
- package/v1/providers/anyscale.yaml +106 -0
- package/v1/providers/azure.yaml +155 -0
- package/v1/providers/baichuan.yaml +168 -0
- package/v1/providers/baidu.yaml +173 -0
- package/v1/providers/cerebras.yaml +178 -0
- package/v1/providers/cohere.yaml +175 -0
- package/v1/providers/deepinfra.yaml +156 -0
- package/v1/providers/deepseek.yaml +189 -0
- package/v1/providers/doubao.yaml +172 -0
- package/v1/providers/fireworks.yaml +187 -0
- package/v1/providers/gemini.yaml +229 -0
- package/v1/providers/groq.yaml +181 -0
- package/v1/providers/huggingface.yaml +157 -0
- package/v1/providers/hunyuan.yaml +162 -0
- package/v1/providers/jina.yaml +171 -0
- package/v1/providers/lepton.yaml +183 -0
- package/v1/providers/minimax.yaml +172 -0
- package/v1/providers/mistral.yaml +186 -0
- package/v1/providers/moonshot.yaml +176 -0
- package/v1/providers/nvidia.yaml +172 -0
- package/v1/providers/openai.yaml +224 -0
- package/v1/providers/openrouter.yaml +181 -0
- package/v1/providers/perplexity.yaml +144 -0
- package/v1/providers/qwen.yaml +192 -0
- package/v1/providers/replicate.yaml +159 -0
- package/v1/providers/sensenova.yaml +153 -0
- package/v1/providers/siliconflow.yaml +156 -0
- package/v1/providers/spark.yaml +167 -0
- package/v1/providers/stability.yaml +185 -0
- package/v1/providers/tiangong.yaml +170 -0
- package/v1/providers/together.yaml +156 -0
- package/v1/providers/writer.yaml +212 -0
- package/v1/providers/xai.yaml +206 -0
- package/v1/providers/yi.yaml +168 -0
- package/v1/providers/zhipu.yaml +171 -0
- package/v1/spec.yaml +637 -0
- package/v2/providers/anthropic.yaml +244 -0
- package/v2/providers/cohere.yaml +75 -0
- package/v2/providers/deepseek.yaml +176 -0
- package/v2/providers/doubao.yaml +169 -0
- package/v2/providers/google.yaml +245 -0
- package/v2/providers/jina.yaml +55 -0
- package/v2/providers/moonshot.yaml +186 -0
- package/v2/providers/openai.yaml +266 -0
- package/v2/providers/qwen.yaml +174 -0
- package/v2/providers/zhipu.yaml +176 -0
- package/v2-alpha/providers/anthropic.yaml +134 -0
- package/v2-alpha/providers/gemini.yaml +144 -0
- package/v2-alpha/providers/openai.yaml +154 -0
- package/v2-alpha/spec.yaml +512 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v2/provider-contract.json",
|
|
4
|
+
"title": "AI-Protocol V2 Provider Contract",
|
|
5
|
+
"description": "Defines the runtime contract between AI-Protocol and provider implementations. Specifies capability matrices, request/response mapping, degradation strategies, and API behavioral guarantees. This schema drives the ProviderDriver abstraction in both Rust and Python runtimes.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["contract_version", "provider_id", "api_style", "request_mapping", "response_mapping"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"contract_version": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"const": "1.0",
|
|
12
|
+
"description": "Contract schema version"
|
|
13
|
+
},
|
|
14
|
+
"provider_id": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"pattern": "^[a-z0-9][a-z0-9-_]{1,63}$",
|
|
17
|
+
"description": "Must match the provider manifest id"
|
|
18
|
+
},
|
|
19
|
+
"api_style": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": ["openai_compatible", "anthropic_messages", "gemini_generate", "custom"],
|
|
22
|
+
"description": "Primary API style determines the base request/response transformation"
|
|
23
|
+
},
|
|
24
|
+
"api_version": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "Provider API version string (e.g. '2023-06-01' for Anthropic)"
|
|
27
|
+
},
|
|
28
|
+
"request_mapping": {
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "How to transform a UnifiedRequest into provider-specific format",
|
|
31
|
+
"required": ["message_format", "role_mapping"],
|
|
32
|
+
"properties": {
|
|
33
|
+
"message_format": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": ["openai_messages", "anthropic_messages", "gemini_contents", "custom"],
|
|
36
|
+
"description": "Message array format style"
|
|
37
|
+
},
|
|
38
|
+
"role_mapping": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"description": "Maps AI-Protocol roles to provider-specific roles",
|
|
41
|
+
"properties": {
|
|
42
|
+
"system": { "type": "string", "default": "system" },
|
|
43
|
+
"user": { "type": "string", "default": "user" },
|
|
44
|
+
"assistant": { "type": "string", "default": "assistant" },
|
|
45
|
+
"tool": { "type": "string", "default": "tool" }
|
|
46
|
+
},
|
|
47
|
+
"additionalProperties": { "type": "string" }
|
|
48
|
+
},
|
|
49
|
+
"system_message_handling": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"enum": ["inline", "top_level_field", "prepend_to_user", "not_supported"],
|
|
52
|
+
"default": "inline",
|
|
53
|
+
"description": "How system messages are placed: inline in messages array, as a top-level 'system' field, prepended to first user message, or not supported"
|
|
54
|
+
},
|
|
55
|
+
"content_block_mapping": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"description": "Maps ContentBlock types to provider format",
|
|
58
|
+
"properties": {
|
|
59
|
+
"text": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"field": { "type": "string", "default": "content" },
|
|
63
|
+
"wrapper": { "type": "string", "enum": ["string", "array_of_parts", "content_blocks"] }
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"image": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"format": { "type": "string", "enum": ["openai_url", "anthropic_source", "gemini_inline_data"] },
|
|
70
|
+
"base64_field": { "type": "string" },
|
|
71
|
+
"url_field": { "type": "string" }
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"audio": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {
|
|
77
|
+
"format": { "type": "string" },
|
|
78
|
+
"supported": { "type": "boolean", "default": false }
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"video": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"format": { "type": "string" },
|
|
85
|
+
"supported": { "type": "boolean", "default": false }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"tool_use": {
|
|
89
|
+
"type": "object",
|
|
90
|
+
"properties": {
|
|
91
|
+
"format": { "type": "string", "enum": ["openai_tool_calls", "anthropic_tool_use", "gemini_function_call"] },
|
|
92
|
+
"id_field": { "type": "string" },
|
|
93
|
+
"name_field": { "type": "string" },
|
|
94
|
+
"arguments_field": { "type": "string" }
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"tool_result": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"properties": {
|
|
100
|
+
"format": { "type": "string", "enum": ["openai_tool_message", "anthropic_tool_result", "gemini_function_response"] },
|
|
101
|
+
"id_field": { "type": "string" },
|
|
102
|
+
"content_field": { "type": "string" }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"additionalProperties": false
|
|
107
|
+
},
|
|
108
|
+
"parameter_aliases": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"description": "Maps unified parameter names to provider-specific names",
|
|
111
|
+
"additionalProperties": { "type": "string" }
|
|
112
|
+
},
|
|
113
|
+
"required_headers": {
|
|
114
|
+
"type": "array",
|
|
115
|
+
"description": "Headers that must be included in every request",
|
|
116
|
+
"items": {
|
|
117
|
+
"type": "object",
|
|
118
|
+
"required": ["name", "value"],
|
|
119
|
+
"properties": {
|
|
120
|
+
"name": { "type": "string" },
|
|
121
|
+
"value": { "type": "string" },
|
|
122
|
+
"condition": { "type": "string", "description": "Capability condition (e.g. 'computer_use', 'mcp')" }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"additionalProperties": false
|
|
128
|
+
},
|
|
129
|
+
"response_mapping": {
|
|
130
|
+
"type": "object",
|
|
131
|
+
"description": "How to extract unified response from provider-specific format",
|
|
132
|
+
"required": ["content_path", "finish_reason_path"],
|
|
133
|
+
"properties": {
|
|
134
|
+
"content_path": {
|
|
135
|
+
"type": "string",
|
|
136
|
+
"description": "JSONPath to extract text content from non-streaming response"
|
|
137
|
+
},
|
|
138
|
+
"finish_reason_path": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"description": "JSONPath to extract finish reason"
|
|
141
|
+
},
|
|
142
|
+
"usage_path": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "JSONPath to extract token usage"
|
|
145
|
+
},
|
|
146
|
+
"tool_calls_path": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"description": "JSONPath to extract tool calls"
|
|
149
|
+
},
|
|
150
|
+
"finish_reason_mapping": {
|
|
151
|
+
"type": "object",
|
|
152
|
+
"description": "Maps provider finish reasons to unified reasons",
|
|
153
|
+
"additionalProperties": { "type": "string" }
|
|
154
|
+
},
|
|
155
|
+
"error_extraction": {
|
|
156
|
+
"type": "object",
|
|
157
|
+
"properties": {
|
|
158
|
+
"type_path": { "type": "string" },
|
|
159
|
+
"message_path": { "type": "string" },
|
|
160
|
+
"code_path": { "type": "string" }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"additionalProperties": false
|
|
165
|
+
},
|
|
166
|
+
"capability_contracts": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"description": "Per-capability behavioral contracts and feature negotiation",
|
|
169
|
+
"properties": {
|
|
170
|
+
"streaming": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"protocol": { "type": "string", "enum": ["sse", "ndjson", "websocket"] },
|
|
174
|
+
"supports_usage_in_stream": { "type": "boolean", "default": false },
|
|
175
|
+
"supports_tool_streaming": { "type": "boolean", "default": false },
|
|
176
|
+
"done_signal": { "type": "string" }
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"tools": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"properties": {
|
|
182
|
+
"definition_format": { "type": "string", "enum": ["openai_functions", "anthropic_tools", "gemini_declarations"] },
|
|
183
|
+
"supports_parallel": { "type": "boolean", "default": false },
|
|
184
|
+
"supports_forced_tool": { "type": "boolean", "default": false },
|
|
185
|
+
"max_tools": { "type": "integer" }
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"structured_output": {
|
|
189
|
+
"type": "object",
|
|
190
|
+
"properties": {
|
|
191
|
+
"json_mode": { "type": "boolean", "default": false },
|
|
192
|
+
"json_schema_mode": { "type": "boolean", "default": false },
|
|
193
|
+
"response_format_field": { "type": "string" }
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
"mcp": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"properties": {
|
|
199
|
+
"integration_method": { "type": "string", "enum": ["native_api", "tool_bridge", "not_supported"] },
|
|
200
|
+
"tool_injection_format": { "type": "string" },
|
|
201
|
+
"requires_beta_header": { "type": "string" }
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"computer_use": {
|
|
205
|
+
"type": "object",
|
|
206
|
+
"properties": {
|
|
207
|
+
"integration_method": { "type": "string", "enum": ["native_tool", "sdk_config", "not_supported"] },
|
|
208
|
+
"action_format": { "type": "string" },
|
|
209
|
+
"requires_beta_header": { "type": "string" }
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"generative": {
|
|
213
|
+
"type": "object",
|
|
214
|
+
"description": "Generative LLM capability contract for token reporting, reasoning, and output modes",
|
|
215
|
+
"properties": {
|
|
216
|
+
"token_usage_format": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"enum": ["openai_usage", "anthropic_usage", "gemini_usage", "custom"],
|
|
219
|
+
"description": "Provider-specific token usage response format"
|
|
220
|
+
},
|
|
221
|
+
"token_usage_fields": {
|
|
222
|
+
"type": "object",
|
|
223
|
+
"description": "JSONPath mappings for token usage extraction",
|
|
224
|
+
"properties": {
|
|
225
|
+
"prompt_tokens": { "type": "string" },
|
|
226
|
+
"completion_tokens": { "type": "string" },
|
|
227
|
+
"total_tokens": { "type": "string" },
|
|
228
|
+
"reasoning_tokens": { "type": "string" },
|
|
229
|
+
"cache_read_tokens": { "type": "string" },
|
|
230
|
+
"cache_creation_tokens": { "type": "string" }
|
|
231
|
+
},
|
|
232
|
+
"additionalProperties": { "type": "string" }
|
|
233
|
+
},
|
|
234
|
+
"reasoning_mode": {
|
|
235
|
+
"type": "object",
|
|
236
|
+
"description": "Extended thinking / reasoning mode contract",
|
|
237
|
+
"properties": {
|
|
238
|
+
"supported": { "type": "boolean", "default": false },
|
|
239
|
+
"activation_method": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"enum": ["parameter", "header", "model_suffix", "not_supported"],
|
|
242
|
+
"description": "How to activate reasoning/thinking mode"
|
|
243
|
+
},
|
|
244
|
+
"activation_field": { "type": "string", "description": "Field name or header to set" },
|
|
245
|
+
"thinking_block_format": {
|
|
246
|
+
"type": "string",
|
|
247
|
+
"enum": ["content_block", "separate_field", "interleaved"],
|
|
248
|
+
"description": "How thinking content appears in response"
|
|
249
|
+
},
|
|
250
|
+
"supports_streaming_thinking": { "type": "boolean", "default": false }
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"context_window_contract": {
|
|
254
|
+
"type": "object",
|
|
255
|
+
"description": "Context window limits and overflow behavior",
|
|
256
|
+
"properties": {
|
|
257
|
+
"max_context_tokens_field": { "type": "string", "description": "Where max context is declared per model" },
|
|
258
|
+
"overflow_error_code": { "type": "string", "description": "Provider error code for context overflow" },
|
|
259
|
+
"overflow_ai_protocol_code": { "type": "string", "default": "E1003", "description": "AI-Protocol error code mapping" }
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
"additionalProperties": false
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
"additionalProperties": false
|
|
267
|
+
},
|
|
268
|
+
"degradation": {
|
|
269
|
+
"type": "object",
|
|
270
|
+
"description": "Defines graceful degradation when capabilities are unavailable",
|
|
271
|
+
"properties": {
|
|
272
|
+
"strategy": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"enum": ["error", "fallback", "silent_skip"],
|
|
275
|
+
"default": "error",
|
|
276
|
+
"description": "Default degradation strategy"
|
|
277
|
+
},
|
|
278
|
+
"rules": {
|
|
279
|
+
"type": "array",
|
|
280
|
+
"items": {
|
|
281
|
+
"type": "object",
|
|
282
|
+
"required": ["capability", "action"],
|
|
283
|
+
"properties": {
|
|
284
|
+
"capability": { "type": "string" },
|
|
285
|
+
"action": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"enum": ["error", "fallback_text", "strip_content", "convert_to_text"]
|
|
288
|
+
},
|
|
289
|
+
"message": { "type": "string", "description": "Human-readable degradation message" }
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"additionalProperties": false
|
|
295
|
+
},
|
|
296
|
+
"rate_limit_contract": {
|
|
297
|
+
"type": "object",
|
|
298
|
+
"description": "Rate limit behavioral contract",
|
|
299
|
+
"properties": {
|
|
300
|
+
"supports_header_parsing": { "type": "boolean", "default": false },
|
|
301
|
+
"retry_after_source": { "type": "string", "enum": ["header", "body", "none"] },
|
|
302
|
+
"quota_tracking": { "type": "boolean", "default": false }
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"authentication_contract": {
|
|
306
|
+
"type": "object",
|
|
307
|
+
"description": "Authentication behavioral contract",
|
|
308
|
+
"properties": {
|
|
309
|
+
"method": { "type": "string", "enum": ["bearer", "api_key_header", "query_param", "oauth2"] },
|
|
310
|
+
"token_refresh": { "type": "boolean", "default": false },
|
|
311
|
+
"multi_key_support": { "type": "boolean", "default": false }
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"additionalProperties": false
|
|
316
|
+
}
|
|
317
|
+
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v2/provider.json",
|
|
4
|
+
"title": "AI Protocol V2 Provider Manifest",
|
|
5
|
+
"description": "Complete provider manifest schema for AI-Protocol V2. Supports the three-ring concentric circle model: Ring 1 (Core Skeleton), Ring 2 (Capability Mapping), Ring 3 (Advanced Extensions).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"id",
|
|
9
|
+
"protocol_version",
|
|
10
|
+
"endpoint",
|
|
11
|
+
"error_classification",
|
|
12
|
+
"capabilities"
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"$schema": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "Schema reference URL"
|
|
18
|
+
},
|
|
19
|
+
"id": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"pattern": "^[a-z0-9][a-z0-9-_]{1,63}$",
|
|
22
|
+
"description": "Stable provider identifier (lowercase, alphanumeric, hyphens, underscores)"
|
|
23
|
+
},
|
|
24
|
+
"protocol_version": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"description": "AI-Protocol version this manifest conforms to"
|
|
27
|
+
},
|
|
28
|
+
"name": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"description": "Human-readable provider name"
|
|
31
|
+
},
|
|
32
|
+
"version": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Provider API version"
|
|
35
|
+
},
|
|
36
|
+
"status": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": ["stable", "beta", "deprecated"],
|
|
39
|
+
"default": "stable",
|
|
40
|
+
"description": "Provider status"
|
|
41
|
+
},
|
|
42
|
+
"category": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"enum": ["ai_provider", "model_provider", "third_party_aggregator"],
|
|
45
|
+
"description": "Provider category"
|
|
46
|
+
},
|
|
47
|
+
"official_url": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"format": "uri",
|
|
50
|
+
"description": "Official documentation website"
|
|
51
|
+
},
|
|
52
|
+
"support_contact": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"format": "uri",
|
|
55
|
+
"description": "Support or feedback link"
|
|
56
|
+
},
|
|
57
|
+
"endpoint": {
|
|
58
|
+
"$ref": "./endpoint.json"
|
|
59
|
+
},
|
|
60
|
+
"availability": {
|
|
61
|
+
"$ref": "./availability.json"
|
|
62
|
+
},
|
|
63
|
+
"capabilities": {
|
|
64
|
+
"$ref": "./capabilities.json"
|
|
65
|
+
},
|
|
66
|
+
"error_classification": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"description": "Error classification mappings for this provider",
|
|
69
|
+
"properties": {
|
|
70
|
+
"by_http_status": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"additionalProperties": { "type": "string" }
|
|
73
|
+
},
|
|
74
|
+
"by_error_code": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"additionalProperties": { "type": "string" }
|
|
77
|
+
},
|
|
78
|
+
"retry_after_extraction": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"description": "Optional pattern to extract Retry-After from error response body when header is absent",
|
|
81
|
+
"properties": {
|
|
82
|
+
"pattern": { "type": "string", "description": "Regex with capture group for numeric value" },
|
|
83
|
+
"unit": { "type": "string", "enum": ["seconds", "milliseconds"], "default": "seconds" }
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"notes": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": { "type": "string" }
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"parameters": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"description": "Standard parameter definitions for this provider",
|
|
95
|
+
"additionalProperties": true
|
|
96
|
+
},
|
|
97
|
+
"streaming": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"description": "Streaming configuration (decoder, event_map, accumulator, candidate)",
|
|
100
|
+
"additionalProperties": true
|
|
101
|
+
},
|
|
102
|
+
"api_families": {
|
|
103
|
+
"oneOf": [
|
|
104
|
+
{ "type": "array", "items": { "type": "string" } },
|
|
105
|
+
{ "type": "object", "additionalProperties": true }
|
|
106
|
+
],
|
|
107
|
+
"description": "API family declarations"
|
|
108
|
+
},
|
|
109
|
+
"default_api_family": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Default API family to use"
|
|
112
|
+
},
|
|
113
|
+
"endpoints": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"description": "Named endpoint definitions",
|
|
116
|
+
"additionalProperties": true
|
|
117
|
+
},
|
|
118
|
+
"services": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"description": "Service endpoint definitions (list_models, etc.)",
|
|
121
|
+
"additionalProperties": true
|
|
122
|
+
},
|
|
123
|
+
"rate_limit_headers": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"description": "Rate limit header mappings",
|
|
126
|
+
"additionalProperties": true
|
|
127
|
+
},
|
|
128
|
+
"retry_policy": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"description": "Retry policy configuration",
|
|
131
|
+
"properties": {
|
|
132
|
+
"strategy": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"enum": ["exponential_backoff", "linear_backoff", "fixed_delay"]
|
|
135
|
+
},
|
|
136
|
+
"max_retries": { "type": "integer", "minimum": 0 },
|
|
137
|
+
"min_delay_ms": { "type": "integer", "minimum": 0 },
|
|
138
|
+
"max_delay_ms": { "type": "integer", "minimum": 0 },
|
|
139
|
+
"jitter": { "type": "string", "enum": ["full", "equal", "none"] },
|
|
140
|
+
"retry_on_http_status": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": { "type": "integer" }
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"termination": {
|
|
147
|
+
"type": "object",
|
|
148
|
+
"description": "Termination reason normalization",
|
|
149
|
+
"properties": {
|
|
150
|
+
"source_field": { "type": "string" },
|
|
151
|
+
"mapping": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"additionalProperties": { "type": "string" }
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"guardrails": {
|
|
158
|
+
"type": "object",
|
|
159
|
+
"description": "Input/output guardrail configuration",
|
|
160
|
+
"additionalProperties": true
|
|
161
|
+
},
|
|
162
|
+
"features": {
|
|
163
|
+
"type": "object",
|
|
164
|
+
"description": "Protocol-level feature flags",
|
|
165
|
+
"additionalProperties": { "type": "boolean" }
|
|
166
|
+
},
|
|
167
|
+
"multimodal": {
|
|
168
|
+
"$ref": "./multimodal.json",
|
|
169
|
+
"description": "Extended multimodal capability configuration (Ring 2)"
|
|
170
|
+
},
|
|
171
|
+
"computer_use": {
|
|
172
|
+
"$ref": "./computer-use.json",
|
|
173
|
+
"description": "Computer Use / GUI automation configuration (Ring 2)"
|
|
174
|
+
},
|
|
175
|
+
"mcp": {
|
|
176
|
+
"$ref": "./mcp.json",
|
|
177
|
+
"description": "Model Context Protocol integration configuration (Ring 2)"
|
|
178
|
+
},
|
|
179
|
+
"context_policy": {
|
|
180
|
+
"$ref": "./context-policy.json",
|
|
181
|
+
"description": "Context window management policy configuration (Ring 3)"
|
|
182
|
+
},
|
|
183
|
+
"provider_contract": {
|
|
184
|
+
"$ref": "./provider-contract.json",
|
|
185
|
+
"description": "Runtime provider driver contract specification (Ring 3)"
|
|
186
|
+
},
|
|
187
|
+
"capability_profile": {
|
|
188
|
+
"$ref": "./capability-profile.json",
|
|
189
|
+
"description": "Experimental I/O/P/S/C capability profile metadata (design-stage, optional)"
|
|
190
|
+
},
|
|
191
|
+
"metadata": {
|
|
192
|
+
"type": "object",
|
|
193
|
+
"additionalProperties": true,
|
|
194
|
+
"description": "Additional provider-specific metadata"
|
|
195
|
+
},
|
|
196
|
+
"pricing": {
|
|
197
|
+
"$ref": "./pricing.json",
|
|
198
|
+
"description": "Optional pricing for cost estimation (per 1k tokens)"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"additionalProperties": false
|
|
202
|
+
}
|
|
203
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v2/regions.json",
|
|
4
|
+
"title": "Region Definitions",
|
|
5
|
+
"description": "Standard region identifiers for provider availability",
|
|
6
|
+
"type": "array",
|
|
7
|
+
"minItems": 1,
|
|
8
|
+
"items": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"enum": ["cn", "global", "us", "eu"]
|
|
11
|
+
},
|
|
12
|
+
"uniqueItems": true
|
|
13
|
+
}
|
|
14
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
$schema: "https://raw.githubusercontent.com/ailib-official/ai-protocol/main/schemas/v1.json"
|
|
2
|
+
protocol_version: "1.1"
|
|
3
|
+
|
|
4
|
+
# AI21 Labs Model Instances
|
|
5
|
+
#
|
|
6
|
+
# VERIFIED_AT: 2026-01-29 (based on public AI21 documentation)
|
|
7
|
+
#
|
|
8
|
+
# Notes:
|
|
9
|
+
# - AI21 Labs is known for Jamba models (SSM-Transformer hybrid).
|
|
10
|
+
# - Jamba models support very long context windows.
|
|
11
|
+
|
|
12
|
+
models:
|
|
13
|
+
# Jamba 1.5 models
|
|
14
|
+
jamba-1.5-mini:
|
|
15
|
+
provider: ai21
|
|
16
|
+
model_id: "jamba-1.5-mini"
|
|
17
|
+
display_name: "Jamba 1.5 Mini"
|
|
18
|
+
verification:
|
|
19
|
+
status: unverified
|
|
20
|
+
verified_at: "2026-01-29"
|
|
21
|
+
source: "documentation"
|
|
22
|
+
notes: "Based on public documentation. Runtime verification recommended."
|
|
23
|
+
context_window: 256000
|
|
24
|
+
capabilities: [chat, tools, streaming]
|
|
25
|
+
status: active
|
|
26
|
+
tags: ["ai21", "jamba", "ssm", "long_context"]
|
|
27
|
+
pricing:
|
|
28
|
+
input_per_token: 0.0000002
|
|
29
|
+
output_per_token: 0.0000004
|
|
30
|
+
|
|
31
|
+
jamba-1.5-large:
|
|
32
|
+
provider: ai21
|
|
33
|
+
model_id: "jamba-1.5-large"
|
|
34
|
+
display_name: "Jamba 1.5 Large"
|
|
35
|
+
verification:
|
|
36
|
+
status: unverified
|
|
37
|
+
verified_at: "2026-01-29"
|
|
38
|
+
source: "documentation"
|
|
39
|
+
context_window: 256000
|
|
40
|
+
capabilities: [chat, tools, streaming]
|
|
41
|
+
status: active
|
|
42
|
+
tags: ["ai21", "jamba", "ssm", "long_context", "flagship"]
|
|
43
|
+
pricing:
|
|
44
|
+
input_per_token: 0.000002
|
|
45
|
+
output_per_token: 0.000008
|
|
46
|
+
|
|
47
|
+
# Jamba Instruct (older version)
|
|
48
|
+
jamba-instruct:
|
|
49
|
+
provider: ai21
|
|
50
|
+
model_id: "jamba-instruct"
|
|
51
|
+
display_name: "Jamba Instruct"
|
|
52
|
+
verification:
|
|
53
|
+
status: unverified
|
|
54
|
+
verified_at: "2026-01-29"
|
|
55
|
+
source: "documentation"
|
|
56
|
+
context_window: 256000
|
|
57
|
+
capabilities: [chat, streaming]
|
|
58
|
+
status: active
|
|
59
|
+
tags: ["ai21", "jamba", "ssm", "instruct"]
|
|
60
|
+
pricing:
|
|
61
|
+
input_per_token: 0.0000005
|
|
62
|
+
output_per_token: 0.0000007
|
|
63
|
+
|
|
64
|
+
# Jurassic-2 models (legacy but still available)
|
|
65
|
+
j2-ultra:
|
|
66
|
+
provider: ai21
|
|
67
|
+
model_id: "j2-ultra"
|
|
68
|
+
display_name: "Jurassic-2 Ultra"
|
|
69
|
+
verification:
|
|
70
|
+
status: unverified
|
|
71
|
+
verified_at: "2026-01-29"
|
|
72
|
+
source: "documentation"
|
|
73
|
+
notes: "Legacy model; Jamba recommended for new projects."
|
|
74
|
+
context_window: 8192
|
|
75
|
+
capabilities: [completion, streaming]
|
|
76
|
+
status: deprecated
|
|
77
|
+
tags: ["ai21", "jurassic", "legacy"]
|
|
78
|
+
pricing:
|
|
79
|
+
input_per_token: 0.000015
|
|
80
|
+
output_per_token: 0.000015
|
|
81
|
+
|
|
82
|
+
j2-mid:
|
|
83
|
+
provider: ai21
|
|
84
|
+
model_id: "j2-mid"
|
|
85
|
+
display_name: "Jurassic-2 Mid"
|
|
86
|
+
verification:
|
|
87
|
+
status: unverified
|
|
88
|
+
verified_at: "2026-01-29"
|
|
89
|
+
source: "documentation"
|
|
90
|
+
notes: "Legacy model; Jamba recommended for new projects."
|
|
91
|
+
context_window: 8192
|
|
92
|
+
capabilities: [completion, streaming]
|
|
93
|
+
status: deprecated
|
|
94
|
+
tags: ["ai21", "jurassic", "legacy"]
|
|
95
|
+
pricing:
|
|
96
|
+
input_per_token: 0.00001
|
|
97
|
+
output_per_token: 0.00001
|