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.
@@ -42,6 +79,7 @@ When a prompt includes multiple cache blocks (for example `cache.openai` + `cach
42
79
43
80
```typescript
44
81
import { openaiAdapter } from 'promptopskit/openai';
82
+
import { openaiResponsesAdapter } from 'promptopskit/openai-responses';
45
83
import { anthropicAdapter } from 'promptopskit/anthropic';
46
84
import { geminiAdapter } from 'promptopskit/gemini';
47
85
import { openrouterAdapter } from 'promptopskit/openrouter';
@@ -63,7 +101,7 @@ interface ProviderAdapter {
63
101
}
64
102
```
65
103
66
-
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.
104
+
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.
67
105
68
106
Server-side example:
69
107
@@ -179,7 +217,7 @@ If you want UsageTap begin/end tracking around a provider call, use the optional
179
217
180
218
See [UsageTap](./usagetap.md) for setup, lifecycle helpers, entitlement behavior, tool gating, standalone usage extractors, and provider examples.
181
219
182
-
## OpenAI
220
+
## OpenAI (`openai`)
183
221
184
222
Body shape: [Chat Completions API](https://platform.openai.com/docs/api-reference/chat)
185
223
@@ -195,6 +233,44 @@ Body shape: [Chat Completions API](https://platform.openai.com/docs/api-referenc
195
233
}
196
234
```
197
235
236
+
## OpenAI Responses (`openai-responses`)
237
+
238
+
Body shape: [Responses API](https://platform.openai.com/docs/api-reference/responses)
239
+
240
+
```json
241
+
{
242
+
"model": "gpt-5.4",
243
+
"instructions": "...",
244
+
"input": [
245
+
{ "role": "user", "content": "..." }
246
+
],
247
+
"temperature": 0.7,
248
+
"reasoning": { "effort": "medium" }
249
+
}
250
+
```
251
+
252
+
Field mapping (differences from `openai`):
253
+
254
+
| Front matter | Body field (`openai-responses`) |
0 commit comments