@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,783 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.1",
|
|
3
|
+
"metadata": {
|
|
4
|
+
"description": "AI-Protocol v1.1 - Standard Specification for AI Model Integration",
|
|
5
|
+
"last_updated": "2026-01-31",
|
|
6
|
+
"release_version": "1.1.1",
|
|
7
|
+
"authors": [
|
|
8
|
+
"AI-Protocol Team"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT OR Apache-2.0"
|
|
11
|
+
},
|
|
12
|
+
"standard_schema": {
|
|
13
|
+
"parameters": {
|
|
14
|
+
"temperature": {
|
|
15
|
+
"type": "float",
|
|
16
|
+
"range": [
|
|
17
|
+
0,
|
|
18
|
+
2
|
|
19
|
+
],
|
|
20
|
+
"default": 1,
|
|
21
|
+
"description": "Controls randomness in the output"
|
|
22
|
+
},
|
|
23
|
+
"max_tokens": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"min": 1,
|
|
26
|
+
"max": 32768,
|
|
27
|
+
"description": "Maximum number of tokens to generate"
|
|
28
|
+
},
|
|
29
|
+
"stream": {
|
|
30
|
+
"type": "boolean",
|
|
31
|
+
"default": false,
|
|
32
|
+
"description": "Enable streaming responses"
|
|
33
|
+
},
|
|
34
|
+
"top_p": {
|
|
35
|
+
"type": "float",
|
|
36
|
+
"range": [
|
|
37
|
+
0,
|
|
38
|
+
1
|
|
39
|
+
],
|
|
40
|
+
"default": 1,
|
|
41
|
+
"description": "Nucleus sampling parameter"
|
|
42
|
+
},
|
|
43
|
+
"frequency_penalty": {
|
|
44
|
+
"type": "float",
|
|
45
|
+
"range": [
|
|
46
|
+
-2,
|
|
47
|
+
2
|
|
48
|
+
],
|
|
49
|
+
"default": 0,
|
|
50
|
+
"description": "Penalize frequent tokens (OpenAI-compatible)"
|
|
51
|
+
},
|
|
52
|
+
"presence_penalty": {
|
|
53
|
+
"type": "float",
|
|
54
|
+
"range": [
|
|
55
|
+
-2,
|
|
56
|
+
2
|
|
57
|
+
],
|
|
58
|
+
"default": 0,
|
|
59
|
+
"description": "Penalize repeated presence (OpenAI-compatible)"
|
|
60
|
+
},
|
|
61
|
+
"top_k": {
|
|
62
|
+
"type": "integer",
|
|
63
|
+
"min": 1,
|
|
64
|
+
"max": 500,
|
|
65
|
+
"description": "Top-K filtering (Gemini/open-source compatible)"
|
|
66
|
+
},
|
|
67
|
+
"stop_sequences": {
|
|
68
|
+
"type": "array",
|
|
69
|
+
"description": "Stop sequences to truncate generation"
|
|
70
|
+
},
|
|
71
|
+
"logprobs": {
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"default": false,
|
|
74
|
+
"description": "Return token logprobs when provider supports"
|
|
75
|
+
},
|
|
76
|
+
"top_logprobs": {
|
|
77
|
+
"type": "integer",
|
|
78
|
+
"min": 1,
|
|
79
|
+
"max": 5,
|
|
80
|
+
"description": "Number of top logprobs to return"
|
|
81
|
+
},
|
|
82
|
+
"seed": {
|
|
83
|
+
"type": "integer",
|
|
84
|
+
"description": "Deterministic seed when supported"
|
|
85
|
+
},
|
|
86
|
+
"tool_choice": {
|
|
87
|
+
"type": "string_or_object",
|
|
88
|
+
"values": [
|
|
89
|
+
"auto",
|
|
90
|
+
"none",
|
|
91
|
+
"required",
|
|
92
|
+
"specific"
|
|
93
|
+
],
|
|
94
|
+
"default": "auto",
|
|
95
|
+
"description": "Tool choice policy per request. Runtimes SHOULD accept either a simple string policy (auto/none/required) or a provider-specific object (e.g., OpenAI tool_choice object for selecting a specific tool).",
|
|
96
|
+
"object_shape": {
|
|
97
|
+
"description": "Minimum object contract when tool selection is explicit.",
|
|
98
|
+
"fields": {
|
|
99
|
+
"type": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"values": [
|
|
102
|
+
"function",
|
|
103
|
+
"tool"
|
|
104
|
+
],
|
|
105
|
+
"required": true
|
|
106
|
+
},
|
|
107
|
+
"name": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"required": true,
|
|
110
|
+
"description": "Function/tool name to invoke when type indicates a specific tool."
|
|
111
|
+
},
|
|
112
|
+
"id": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"required": false,
|
|
115
|
+
"description": "Provider-specific tool identifier when available."
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"response_format_mode": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"values": [
|
|
123
|
+
"auto",
|
|
124
|
+
"text",
|
|
125
|
+
"json_object",
|
|
126
|
+
"json_schema"
|
|
127
|
+
],
|
|
128
|
+
"default": "auto",
|
|
129
|
+
"description": "Structured output selection (OpenAI Responses / JSON mode)"
|
|
130
|
+
},
|
|
131
|
+
"reasoning_effort": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"values": [
|
|
134
|
+
"low",
|
|
135
|
+
"medium",
|
|
136
|
+
"high",
|
|
137
|
+
"auto"
|
|
138
|
+
],
|
|
139
|
+
"default": "auto",
|
|
140
|
+
"description": "Reasoning effort for agentic tasks"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"tools": {
|
|
144
|
+
"schema": "standard_tool_definition",
|
|
145
|
+
"choice_policy": [
|
|
146
|
+
"auto",
|
|
147
|
+
"none",
|
|
148
|
+
"required",
|
|
149
|
+
"specific"
|
|
150
|
+
],
|
|
151
|
+
"strict_mode": true,
|
|
152
|
+
"parallel_calls": true
|
|
153
|
+
},
|
|
154
|
+
"response_format": {
|
|
155
|
+
"types": [
|
|
156
|
+
"text",
|
|
157
|
+
"json",
|
|
158
|
+
"structured"
|
|
159
|
+
],
|
|
160
|
+
"schema_validation": true
|
|
161
|
+
},
|
|
162
|
+
"multimodal": {
|
|
163
|
+
"image": {
|
|
164
|
+
"formats": [
|
|
165
|
+
"png",
|
|
166
|
+
"jpeg",
|
|
167
|
+
"gif",
|
|
168
|
+
"webp"
|
|
169
|
+
],
|
|
170
|
+
"max_size": "10MB"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"agentic_loop": {
|
|
174
|
+
"max_iterations": 10,
|
|
175
|
+
"stop_conditions": [
|
|
176
|
+
"tool_result",
|
|
177
|
+
"final_answer"
|
|
178
|
+
],
|
|
179
|
+
"reasoning_effort": "auto"
|
|
180
|
+
},
|
|
181
|
+
"streaming_events": {
|
|
182
|
+
"supported_events": [
|
|
183
|
+
"PartialContentDelta",
|
|
184
|
+
"ThinkingDelta",
|
|
185
|
+
"PartialToolCall",
|
|
186
|
+
"ToolCallStarted",
|
|
187
|
+
"ToolCallEnded",
|
|
188
|
+
"StreamError"
|
|
189
|
+
],
|
|
190
|
+
"thinking_blocks": true,
|
|
191
|
+
"citations_enabled": true,
|
|
192
|
+
"transport_definitions": {
|
|
193
|
+
"sse": {
|
|
194
|
+
"description": "Server-Sent Events (SSE) framing contract used by multiple providers.",
|
|
195
|
+
"framing": {
|
|
196
|
+
"delimiter": "\\n\\n",
|
|
197
|
+
"data_prefix": "data: ",
|
|
198
|
+
"done_signal": "[DONE]"
|
|
199
|
+
},
|
|
200
|
+
"notes": [
|
|
201
|
+
"Runtimes should split frames by delimiter and parse each data payload as JSON when applicable.",
|
|
202
|
+
"Providers MAY emit non-data lines; runtimes should ignore unknown lines unless a provider-specific decoder.strategy says otherwise."
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"termination_reasons": {
|
|
207
|
+
"standard_reasons": [
|
|
208
|
+
{
|
|
209
|
+
"id": "end_turn",
|
|
210
|
+
"description": "Model reached a natural stopping point."
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"id": "max_tokens",
|
|
214
|
+
"description": "Generation stopped because max tokens or context constraints were hit."
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"id": "stop_sequence",
|
|
218
|
+
"description": "Generation stopped because a user-provided stop sequence was encountered."
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"id": "tool_use",
|
|
222
|
+
"description": "Model decided to invoke one or more tools / function calls."
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"id": "refusal",
|
|
226
|
+
"description": "Model refused or safety classifiers intervened (policy)."
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": "pause_turn",
|
|
230
|
+
"description": "Turn was paused and may be continued in a subsequent request."
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"id": "other",
|
|
234
|
+
"description": "Provider-specific or unknown termination."
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"telemetry": {
|
|
240
|
+
"principles": [
|
|
241
|
+
"Telemetry MUST be opt-in. Runtimes MUST NOT force collection or transmission.",
|
|
242
|
+
"Generation and feedback reporting MUST be decoupled; feedback is asynchronous and may be dropped.",
|
|
243
|
+
"Data minimization is required. Prefer ids, indices, and hashes over raw prompt/output text.",
|
|
244
|
+
"A stable request_id (client-generated if necessary) is REQUIRED for closed-loop linkage."
|
|
245
|
+
],
|
|
246
|
+
"feedback_events": {
|
|
247
|
+
"ChoiceSelection": {
|
|
248
|
+
"description": "User selection among multiple candidates (n > 1).",
|
|
249
|
+
"fields": {
|
|
250
|
+
"request_id": {
|
|
251
|
+
"type": "string",
|
|
252
|
+
"required": true,
|
|
253
|
+
"description": "Runtime-generated request identifier used for linkage (not necessarily provider's request id)."
|
|
254
|
+
},
|
|
255
|
+
"chosen_index": {
|
|
256
|
+
"type": "integer",
|
|
257
|
+
"required": true,
|
|
258
|
+
"description": "0-based index of the chosen candidate."
|
|
259
|
+
},
|
|
260
|
+
"rejected_indices": {
|
|
261
|
+
"type": "array",
|
|
262
|
+
"items": "integer",
|
|
263
|
+
"required": false,
|
|
264
|
+
"description": "Optional list of 0-based indices that were shown but not chosen."
|
|
265
|
+
},
|
|
266
|
+
"latency_to_select_ms": {
|
|
267
|
+
"type": "integer",
|
|
268
|
+
"required": false,
|
|
269
|
+
"description": "Time from rendering candidates to the user making a selection (milliseconds)."
|
|
270
|
+
},
|
|
271
|
+
"ui_context": {
|
|
272
|
+
"type": "object",
|
|
273
|
+
"required": false,
|
|
274
|
+
"description": "Optional UI / experiment context (A/B bucket, component, etc.)."
|
|
275
|
+
},
|
|
276
|
+
"candidate_hashes": {
|
|
277
|
+
"type": "array",
|
|
278
|
+
"items": "string",
|
|
279
|
+
"required": false,
|
|
280
|
+
"description": "Optional hashes for the rendered candidates; enables audit/linkage without uploading full text."
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"provider_mappings": {
|
|
285
|
+
"anthropic": {
|
|
286
|
+
"source_field": "stop_reason",
|
|
287
|
+
"notes": [
|
|
288
|
+
"Non-streaming: stop_reason is always non-null.",
|
|
289
|
+
"Streaming: stop_reason is null in message_start, then non-null otherwise."
|
|
290
|
+
],
|
|
291
|
+
"map": {
|
|
292
|
+
"end_turn": "end_turn",
|
|
293
|
+
"max_tokens": "max_tokens",
|
|
294
|
+
"stop_sequence": "stop_sequence",
|
|
295
|
+
"tool_use": "tool_use",
|
|
296
|
+
"pause_turn": "pause_turn",
|
|
297
|
+
"refusal": "refusal"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"openai": {
|
|
301
|
+
"source_field": "finish_reason",
|
|
302
|
+
"notes": [
|
|
303
|
+
"finish_reason is reported per candidate."
|
|
304
|
+
],
|
|
305
|
+
"map": {
|
|
306
|
+
"stop": "end_turn",
|
|
307
|
+
"length": "max_tokens",
|
|
308
|
+
"tool_calls": "tool_use",
|
|
309
|
+
"content_filter": "refusal",
|
|
310
|
+
"null": "other"
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
"runtime_behavior": [
|
|
315
|
+
"Runtimes SHOULD surface standardized termination reasons to users and logs.",
|
|
316
|
+
"Runtimes SHOULD preserve the original provider-specific reason in extra metadata for debugging."
|
|
317
|
+
]
|
|
318
|
+
},
|
|
319
|
+
"event_definitions": {
|
|
320
|
+
"StreamError": {
|
|
321
|
+
"description": "A stream-level error event emitted after a streaming/realtime session has been established. Most errors are recoverable and the session may stay open; runtimes SHOULD monitor and log error messages by default.",
|
|
322
|
+
"payload": {
|
|
323
|
+
"type": "object",
|
|
324
|
+
"required": [
|
|
325
|
+
"error"
|
|
326
|
+
],
|
|
327
|
+
"properties": {
|
|
328
|
+
"type": {
|
|
329
|
+
"type": "string",
|
|
330
|
+
"description": "Optional event type when provided by the stream (e.g., 'error')."
|
|
331
|
+
},
|
|
332
|
+
"event_id": {
|
|
333
|
+
"type": "string",
|
|
334
|
+
"description": "Optional unique ID of the server event when provided."
|
|
335
|
+
},
|
|
336
|
+
"error": {
|
|
337
|
+
"type": "any",
|
|
338
|
+
"description": "Error payload. May be an object (rich error) or a string (human-readable message), depending on provider."
|
|
339
|
+
},
|
|
340
|
+
"model_version": {
|
|
341
|
+
"type": "string",
|
|
342
|
+
"description": "Optional model version string when provided by the stream."
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"content_blocks": {
|
|
350
|
+
"types": [
|
|
351
|
+
"text",
|
|
352
|
+
"tool_use",
|
|
353
|
+
"tool_result",
|
|
354
|
+
"thinking"
|
|
355
|
+
],
|
|
356
|
+
"tool_use": {
|
|
357
|
+
"description": "A request from the model to invoke a tool.",
|
|
358
|
+
"required_fields": [
|
|
359
|
+
"type",
|
|
360
|
+
"id",
|
|
361
|
+
"name",
|
|
362
|
+
"input"
|
|
363
|
+
],
|
|
364
|
+
"fields": {
|
|
365
|
+
"type": {
|
|
366
|
+
"const": "tool_use"
|
|
367
|
+
},
|
|
368
|
+
"id": {
|
|
369
|
+
"type": "string",
|
|
370
|
+
"description": "Unique identifier for this tool invocation (tool_use id / tool_call id)."
|
|
371
|
+
},
|
|
372
|
+
"name": {
|
|
373
|
+
"type": "string",
|
|
374
|
+
"description": "Tool name to invoke."
|
|
375
|
+
},
|
|
376
|
+
"input": {
|
|
377
|
+
"type": "object",
|
|
378
|
+
"description": "Tool input parameters (structured object)."
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"tool_result": {
|
|
383
|
+
"description": "A tool execution result provided back to the model.",
|
|
384
|
+
"required_fields": [
|
|
385
|
+
"type",
|
|
386
|
+
"tool_use_id",
|
|
387
|
+
"content"
|
|
388
|
+
],
|
|
389
|
+
"fields": {
|
|
390
|
+
"type": {
|
|
391
|
+
"const": "tool_result"
|
|
392
|
+
},
|
|
393
|
+
"tool_use_id": {
|
|
394
|
+
"type": "string",
|
|
395
|
+
"description": "The id of the corresponding tool_use/tool_call."
|
|
396
|
+
},
|
|
397
|
+
"content": {
|
|
398
|
+
"type": "any",
|
|
399
|
+
"description": "Result content (provider/runtime-defined). Prefer a structured object or an array of text blocks."
|
|
400
|
+
},
|
|
401
|
+
"is_error": {
|
|
402
|
+
"type": "boolean",
|
|
403
|
+
"description": "Optional: whether the tool execution failed."
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"retry_policy": {
|
|
409
|
+
"fields": {
|
|
410
|
+
"strategy": {
|
|
411
|
+
"values": [
|
|
412
|
+
"none",
|
|
413
|
+
"exponential_backoff"
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
"max_retries": {
|
|
417
|
+
"type": "integer",
|
|
418
|
+
"min": 0
|
|
419
|
+
},
|
|
420
|
+
"min_delay_ms": {
|
|
421
|
+
"type": "integer",
|
|
422
|
+
"min": 0
|
|
423
|
+
},
|
|
424
|
+
"max_delay_ms": {
|
|
425
|
+
"type": "integer",
|
|
426
|
+
"min": 0
|
|
427
|
+
},
|
|
428
|
+
"jitter": {
|
|
429
|
+
"values": [
|
|
430
|
+
"none",
|
|
431
|
+
"full",
|
|
432
|
+
"equal"
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
"retry_on_http_status": {
|
|
436
|
+
"type": "array",
|
|
437
|
+
"items": "integer"
|
|
438
|
+
},
|
|
439
|
+
"retry_on_error_status": {
|
|
440
|
+
"type": "array",
|
|
441
|
+
"items": "string"
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
"runtime_notes": [
|
|
445
|
+
"Runtimes SHOULD treat retry_policy as guidance; user overrides may apply.",
|
|
446
|
+
"Runtimes SHOULD apply exponential backoff with an upper bound and optional jitter when enabled."
|
|
447
|
+
]
|
|
448
|
+
},
|
|
449
|
+
"rate_limit_headers": {
|
|
450
|
+
"fields": {
|
|
451
|
+
"requests_limit": {
|
|
452
|
+
"type": "string",
|
|
453
|
+
"description": "Header name that reports request limit."
|
|
454
|
+
},
|
|
455
|
+
"requests_remaining": {
|
|
456
|
+
"type": "string",
|
|
457
|
+
"description": "Header name that reports remaining requests."
|
|
458
|
+
},
|
|
459
|
+
"requests_reset": {
|
|
460
|
+
"type": "string",
|
|
461
|
+
"description": "Header name that reports time until request limit resets (format is provider-specific)."
|
|
462
|
+
},
|
|
463
|
+
"tokens_limit": {
|
|
464
|
+
"type": "string",
|
|
465
|
+
"description": "Header name that reports token limit."
|
|
466
|
+
},
|
|
467
|
+
"tokens_remaining": {
|
|
468
|
+
"type": "string",
|
|
469
|
+
"description": "Header name that reports remaining tokens."
|
|
470
|
+
},
|
|
471
|
+
"tokens_reset": {
|
|
472
|
+
"type": "string",
|
|
473
|
+
"description": "Header name that reports time until token limit resets (format is provider-specific)."
|
|
474
|
+
},
|
|
475
|
+
"retry_after": {
|
|
476
|
+
"type": "string",
|
|
477
|
+
"description": "Header name that reports seconds until retry allowed (Retry-After style), if provided."
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
"runtime_notes": [
|
|
481
|
+
"Runtimes SHOULD treat rate_limit_headers as optional; not all providers return all headers.",
|
|
482
|
+
"When retry_after is present on 429, runtimes SHOULD respect it."
|
|
483
|
+
]
|
|
484
|
+
},
|
|
485
|
+
"error_handling": {
|
|
486
|
+
"error_classes": [
|
|
487
|
+
{
|
|
488
|
+
"id": "invalid_request",
|
|
489
|
+
"description": "Malformed request body, invalid parameters, or unsupported operation.",
|
|
490
|
+
"default_retryable": false
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"id": "authentication",
|
|
494
|
+
"description": "Missing/invalid credentials (API key/token).",
|
|
495
|
+
"default_retryable": false
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"id": "permission_denied",
|
|
499
|
+
"description": "Caller is authenticated but not permitted to access the resource.",
|
|
500
|
+
"default_retryable": false
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"id": "not_found",
|
|
504
|
+
"description": "Requested resource not found.",
|
|
505
|
+
"default_retryable": false
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"id": "quota_exhausted",
|
|
509
|
+
"description": "Account quota/billing/spend limit exceeded.",
|
|
510
|
+
"default_retryable": false
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"id": "rate_limited",
|
|
514
|
+
"description": "Throttled due to request/token limits; typically retryable with backoff.",
|
|
515
|
+
"default_retryable": true
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
"id": "request_too_large",
|
|
519
|
+
"description": "Payload too large (e.g., context too long, request too big).",
|
|
520
|
+
"default_retryable": false
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"id": "timeout",
|
|
524
|
+
"description": "Request timed out or deadline exceeded.",
|
|
525
|
+
"default_retryable": true
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
"id": "conflict",
|
|
529
|
+
"description": "Request conflict (often safe to retry depending on semantics).",
|
|
530
|
+
"default_retryable": true
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
"id": "cancelled",
|
|
534
|
+
"description": "Request was cancelled by client or upstream.",
|
|
535
|
+
"default_retryable": false
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"id": "server_error",
|
|
539
|
+
"description": "Transient server-side failure (5xx).",
|
|
540
|
+
"default_retryable": true
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"id": "overloaded",
|
|
544
|
+
"description": "Service overloaded / temporarily unavailable.",
|
|
545
|
+
"default_retryable": true
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"id": "other",
|
|
549
|
+
"description": "Unknown or provider-specific classification.",
|
|
550
|
+
"default_retryable": false
|
|
551
|
+
}
|
|
552
|
+
],
|
|
553
|
+
"envelope_patterns": {
|
|
554
|
+
"openai_style": {
|
|
555
|
+
"shape": "{ \"error\": { \"message\": string, \"type\": string, \"code\"?: string|null, \"param\"?: string|null } }",
|
|
556
|
+
"extraction": {
|
|
557
|
+
"message": "error.message",
|
|
558
|
+
"type": "error.type",
|
|
559
|
+
"code": "error.code",
|
|
560
|
+
"param": "error.param"
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
"anthropic_style": {
|
|
564
|
+
"shape": "{ \"type\": \"error\", \"error\": { \"type\": string, \"message\": string }, \"request_id\": string }",
|
|
565
|
+
"extraction": {
|
|
566
|
+
"message": "error.message",
|
|
567
|
+
"type": "error.type",
|
|
568
|
+
"request_id": "request_id"
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
"google_cloud_style": {
|
|
572
|
+
"shape": "{ \"error\": { \"code\": integer, \"message\": string, \"status\": string, \"errors\"?: [], \"details\"?: [] } }",
|
|
573
|
+
"extraction": {
|
|
574
|
+
"message": "error.message",
|
|
575
|
+
"http_code": "error.code",
|
|
576
|
+
"status": "error.status",
|
|
577
|
+
"errors": "error.errors",
|
|
578
|
+
"details": "error.details"
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
"runtime_behavior": [
|
|
583
|
+
"Runtimes SHOULD map provider-specific errors into error_classes for logs/UI, while preserving raw fields.",
|
|
584
|
+
"Runtimes SHOULD treat HTTP 401/403 as authentication/permission_denied and avoid retries by default.",
|
|
585
|
+
"Runtimes SHOULD treat HTTP 400/422 as invalid_request and avoid retries by default.",
|
|
586
|
+
"On HTTP 429, runtimes SHOULD distinguish rate-limited vs quota-exhausted when possible (often via message/type/code).",
|
|
587
|
+
"On HTTP 429, if a Retry-After header (or provider-declared retry_after) is present, runtimes SHOULD respect it.",
|
|
588
|
+
"On transient 5xx/overloaded errors, runtimes SHOULD retry with exponential backoff and a cap (see retry_policy).",
|
|
589
|
+
"Runtimes SHOULD cap retries and add jitter to avoid retry storms."
|
|
590
|
+
],
|
|
591
|
+
"provider_field_contract": {
|
|
592
|
+
"purpose": "Clarify how provider configs work together to enable consistent error handling and retry behavior.",
|
|
593
|
+
"fields_relationship": [
|
|
594
|
+
"response_mapping.error: Extracts raw error fields (message, code, type, etc.) from provider responses.",
|
|
595
|
+
"error_classification: Maps HTTP status / provider status strings to standard error_classes.",
|
|
596
|
+
"retry_policy: Declares which errors are retryable and how to retry (strategy, delays, caps).",
|
|
597
|
+
"rate_limit_headers: Declares which HTTP headers expose rate limit state (for throttling/monitoring)."
|
|
598
|
+
],
|
|
599
|
+
"runtime_integration": [
|
|
600
|
+
"Runtimes SHOULD use error_classification output to determine retry eligibility (default_retryable from error_class + explicit retry_policy overrides).",
|
|
601
|
+
"Runtimes SHOULD combine error_classification with retry_policy.retry_on_http_status and retry_policy.retry_on_error_status to finalize retry decisions.",
|
|
602
|
+
"Runtimes SHOULD respect rate_limit_headers.retry_after when present on 429 responses.",
|
|
603
|
+
"Runtimes SHOULD preserve raw provider error fields (via response_mapping) alongside normalized error_class for debugging."
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
"provider_manifest": {
|
|
609
|
+
"identity": {
|
|
610
|
+
"id": {
|
|
611
|
+
"type": "string",
|
|
612
|
+
"pattern": "^[a-z0-9][a-z0-9-_]{1,63}$",
|
|
613
|
+
"required": true,
|
|
614
|
+
"description": "Stable provider identifier (lowercase, alphanumeric, hyphens, underscores)"
|
|
615
|
+
},
|
|
616
|
+
"name": {
|
|
617
|
+
"type": "string",
|
|
618
|
+
"required": false,
|
|
619
|
+
"description": "Human-readable provider name"
|
|
620
|
+
},
|
|
621
|
+
"status": {
|
|
622
|
+
"type": "string",
|
|
623
|
+
"values": [
|
|
624
|
+
"stable",
|
|
625
|
+
"beta",
|
|
626
|
+
"deprecated"
|
|
627
|
+
],
|
|
628
|
+
"default": "stable",
|
|
629
|
+
"description": "Provider status"
|
|
630
|
+
},
|
|
631
|
+
"category": {
|
|
632
|
+
"type": "string",
|
|
633
|
+
"values": [
|
|
634
|
+
"ai_provider",
|
|
635
|
+
"model_provider",
|
|
636
|
+
"third_party_aggregator"
|
|
637
|
+
],
|
|
638
|
+
"required": false,
|
|
639
|
+
"description": "Provider category"
|
|
640
|
+
},
|
|
641
|
+
"official_url": {
|
|
642
|
+
"type": "string",
|
|
643
|
+
"format": "uri",
|
|
644
|
+
"required": false,
|
|
645
|
+
"description": "Official documentation website"
|
|
646
|
+
},
|
|
647
|
+
"support_contact": {
|
|
648
|
+
"type": "string",
|
|
649
|
+
"format": "uri",
|
|
650
|
+
"required": false,
|
|
651
|
+
"description": "Support or feedback link"
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
"endpoint": {
|
|
655
|
+
"base_url": {
|
|
656
|
+
"type": "string",
|
|
657
|
+
"format": "uri",
|
|
658
|
+
"required": true,
|
|
659
|
+
"description": "Absolute base URL of the provider API"
|
|
660
|
+
},
|
|
661
|
+
"protocol": {
|
|
662
|
+
"type": "string",
|
|
663
|
+
"values": [
|
|
664
|
+
"https",
|
|
665
|
+
"http",
|
|
666
|
+
"ws",
|
|
667
|
+
"wss"
|
|
668
|
+
],
|
|
669
|
+
"default": "https",
|
|
670
|
+
"description": "Protocol used for communication"
|
|
671
|
+
},
|
|
672
|
+
"timeout_ms": {
|
|
673
|
+
"type": "integer",
|
|
674
|
+
"min": 100,
|
|
675
|
+
"default": 10000,
|
|
676
|
+
"description": "Default timeout for requests in milliseconds"
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
"availability": {
|
|
680
|
+
"required": {
|
|
681
|
+
"type": "boolean",
|
|
682
|
+
"required": true,
|
|
683
|
+
"description": "Whether the provider must be reachable at runtime startup"
|
|
684
|
+
},
|
|
685
|
+
"regions": {
|
|
686
|
+
"type": "array",
|
|
687
|
+
"min_items": 1,
|
|
688
|
+
"items": {
|
|
689
|
+
"type": "string",
|
|
690
|
+
"values": [
|
|
691
|
+
"cn",
|
|
692
|
+
"global",
|
|
693
|
+
"us",
|
|
694
|
+
"eu"
|
|
695
|
+
]
|
|
696
|
+
},
|
|
697
|
+
"unique_items": true,
|
|
698
|
+
"required": true,
|
|
699
|
+
"description": "Geographic regions where the provider is available",
|
|
700
|
+
"semantics": {
|
|
701
|
+
"cn": "Reachable from mainland China without special routing",
|
|
702
|
+
"global": "Reachable from the general international Internet. This does NOT imply reachability from mainland China.",
|
|
703
|
+
"us": "Explicitly deployed in US region only",
|
|
704
|
+
"eu": "Explicitly deployed in EU region only"
|
|
705
|
+
},
|
|
706
|
+
"notes": [
|
|
707
|
+
"Multiple regions MAY be listed (e.g., ['cn', 'global']) to explicitly declare dual availability",
|
|
708
|
+
"Runtimes MUST NOT assume implicit region coverage"
|
|
709
|
+
]
|
|
710
|
+
},
|
|
711
|
+
"check": {
|
|
712
|
+
"method": {
|
|
713
|
+
"type": "string",
|
|
714
|
+
"values": [
|
|
715
|
+
"HEAD",
|
|
716
|
+
"GET"
|
|
717
|
+
],
|
|
718
|
+
"required": true,
|
|
719
|
+
"description": "HTTP method for health check"
|
|
720
|
+
},
|
|
721
|
+
"path": {
|
|
722
|
+
"type": "string",
|
|
723
|
+
"pattern": "^/",
|
|
724
|
+
"required": true,
|
|
725
|
+
"description": "Path relative to base_url for health check"
|
|
726
|
+
},
|
|
727
|
+
"expected_status": {
|
|
728
|
+
"type": "array",
|
|
729
|
+
"min_items": 1,
|
|
730
|
+
"items": {
|
|
731
|
+
"type": "integer",
|
|
732
|
+
"min": 100,
|
|
733
|
+
"max": 599
|
|
734
|
+
},
|
|
735
|
+
"required": true,
|
|
736
|
+
"description": "HTTP status codes that indicate healthy state"
|
|
737
|
+
},
|
|
738
|
+
"timeout_ms": {
|
|
739
|
+
"type": "integer",
|
|
740
|
+
"min": 100,
|
|
741
|
+
"default": 3000,
|
|
742
|
+
"description": "Timeout for health check in milliseconds"
|
|
743
|
+
},
|
|
744
|
+
"notes": [
|
|
745
|
+
"Health checks SHOULD NOT require authentication",
|
|
746
|
+
"Unauthorized responses (401) MAY be considered healthy if they indicate the service is reachable"
|
|
747
|
+
]
|
|
748
|
+
}
|
|
749
|
+
},
|
|
750
|
+
"capabilities": {
|
|
751
|
+
"streaming": {
|
|
752
|
+
"type": "boolean",
|
|
753
|
+
"required": true,
|
|
754
|
+
"description": "Supports streaming responses"
|
|
755
|
+
},
|
|
756
|
+
"tools": {
|
|
757
|
+
"type": "boolean",
|
|
758
|
+
"required": true,
|
|
759
|
+
"description": "Supports tool / function calling"
|
|
760
|
+
},
|
|
761
|
+
"vision": {
|
|
762
|
+
"type": "boolean",
|
|
763
|
+
"required": true,
|
|
764
|
+
"description": "Supports image or multimodal inputs"
|
|
765
|
+
},
|
|
766
|
+
"agentic": {
|
|
767
|
+
"type": "boolean",
|
|
768
|
+
"default": false,
|
|
769
|
+
"description": "Supports agentic reasoning and multi-turn tool sequences"
|
|
770
|
+
},
|
|
771
|
+
"reasoning": {
|
|
772
|
+
"type": "boolean",
|
|
773
|
+
"default": false,
|
|
774
|
+
"description": "Supports extended reasoning / thinking blocks"
|
|
775
|
+
},
|
|
776
|
+
"parallel_tools": {
|
|
777
|
+
"type": "boolean",
|
|
778
|
+
"default": false,
|
|
779
|
+
"description": "Supports parallel tool invocations"
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|