You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/providers.md
+91-4Lines changed: 91 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,53 @@
1
1
# Provider Adapters
2
2
3
-
PromptOpsKit ships four provider adapters. Direct `render()` calls always produce a `{ body, provider, model }` object shaped for the target API. Async `renderPrompt()` helpers may instead return `{ provider, model, returnMessage }` when context validation is configured to short-circuit before request shaping. You handle the HTTP call — no auth, no headers, no HTTP client opinions.
3
+
PromptOpsKit ships five provider adapters. Direct `render()` calls always produce a `{ body, provider, model }` object shaped for the target API. Async `renderPrompt()` helpers may instead return `{ provider, model, returnMessage }` when context validation is configured to short-circuit before request shaping. You handle the HTTP call — no auth, no headers, no HTTP client opinions.
@@ -41,6 +78,7 @@ The provider passed to `renderPrompt` determines which adapter shapes the body.
41
78
42
79
```typescript
43
80
import { openaiAdapter } from 'promptopskit/openai';
81
+
import { openaiResponsesAdapter } from 'promptopskit/openai-responses';
44
82
import { anthropicAdapter } from 'promptopskit/anthropic';
45
83
import { geminiAdapter } from 'promptopskit/gemini';
46
84
import { openrouterAdapter } from 'promptopskit/openrouter';
@@ -62,7 +100,7 @@ interface ProviderAdapter {
62
100
}
63
101
```
64
102
65
-
Direct adapter rendering accepts the same `environment` and `tier` selectors as `kit.renderPrompt()`. Use the synchronous `validate()` and `render()` methods when you already have a compiled `ResolvedPromptAsset`, and use the async `validatePrompt()` and `renderPrompt()` helpers when you want the adapter to resolve either markdown source or a compiled artifact from disk. Context input validation runs through the same shared prompt-input wrapper for OpenAI, Anthropic, Gemini, and OpenRouter, so `allow_regex`, `deny_regex`, `non_empty`, `reject_secrets`, and `return_message` behave consistently across all four.
103
+
Direct adapter rendering accepts the same `environment` and `tier` selectors as `kit.renderPrompt()`. Use the synchronous `validate()` and `render()` methods when you already have a compiled `ResolvedPromptAsset`, and use the async `validatePrompt()` and `renderPrompt()` helpers when you want the adapter to resolve either markdown source or a compiled artifact from disk. Context input validation runs through the same shared prompt-input wrapper for OpenAI, OpenAI Responses, Anthropic, Gemini, and OpenRouter, so `allow_regex`, `deny_regex`, `non_empty`, `reject_secrets`, and `return_message` behave consistently across all five.
66
104
67
105
Server-side example:
68
106
@@ -178,7 +216,7 @@ If you want UsageTap begin/end tracking around a provider call, use the optional
178
216
179
217
See [UsageTap](./usagetap.md) for setup, lifecycle helpers, entitlement behavior, tool gating, standalone usage extractors, and provider examples.
180
218
181
-
## OpenAI
219
+
## OpenAI (`openai`)
182
220
183
221
Body shape: [Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
184
222
@@ -194,6 +232,44 @@ Body shape: [Chat Completions API](https://platform.openai.com/docs/api-referenc
194
232
}
195
233
```
196
234
235
+
## OpenAI Responses (`openai-responses`)
236
+
237
+
Body shape: [Responses API](https://platform.openai.com/docs/api-reference/responses)
238
+
239
+
```json
240
+
{
241
+
"model": "gpt-5.4",
242
+
"instructions": "...",
243
+
"input": [
244
+
{ "role": "user", "content": "..." }
245
+
],
246
+
"temperature": 0.7,
247
+
"reasoning": { "effort": "medium" }
248
+
}
249
+
```
250
+
251
+
Field mapping (differences from `openai`):
252
+
253
+
| Front matter | Body field (`openai-responses`) |
0 commit comments