SpyBara
Go Premium

Documentation 2026-05-21 06:36 UTC to 2026-05-22 06:33 UTC

3 files changed +261 −1. View all changes and history on the product overview
2026
Fri 29 06:38 Thu 28 06:37 Wed 27 06:42 Sun 24 06:25 Fri 22 06:33 Thu 21 06:36 Wed 20 06:35 Tue 19 11:58 Mon 18 22:01 Thu 14 21:00 Tue 12 18:57 Thu 7 21:57 Wed 6 00:01 Tue 5 23:00 Sat 2 05:57
Details

3import {3import {

4 adminClientExamples,4 adminClientExamples,

5 auditLogExamples,5 auditLogExamples,

6 dataRetentionExamples,

6 inviteUserExamples,7 inviteUserExamples,

8 modelPermissionsExamples,

9 spendAlertExamples,

7} from "./admin-apis-examples";10} from "./admin-apis-examples";

8 11 

9Admin APIs let you automate organization management workflows such as user invitations, audit log review, project administration, API key management, and rate limit operations. Use them for back-office automation, security workflows, and operational tooling that should run outside the dashboard.12Admin APIs let you automate organization management workflows such as user invitations, audit log review, project administration, API key management, spend alerts, data retention, and rate limit operations. Use them for back-office automation, security workflows, and operational tooling that should run outside the dashboard.

10 13 

11For endpoint details, see the [Administration API reference](https://developers.openai.com/api/reference/administration/overview), including [Admin API keys](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys), [Invites](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/invites), [Users](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/users), [Projects](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/projects), and [Audit logs](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/audit_logs).14For endpoint details, see the [Administration API reference](https://developers.openai.com/api/reference/administration/overview), including [Admin API keys](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys), [Invites](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/invites), [Users](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/users), [Projects](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/projects), and [Audit logs](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/audit_logs).

12 15 


24 27 

25Set `OPENAI_ADMIN_KEY`, then initialize the SDK for your language.28Set `OPENAI_ADMIN_KEY`, then initialize the SDK for your language.

26 29 

30## Restrict model access for projects

31 

32Use project model permissions to set an allowlist or denylist for a project. Set `mode` to `allow_list` to allow only the listed models, or set `mode` to `deny_list` to block the listed models while allowing other available models. Model IDs must be visible to the organization, including visible fine-tuned model snapshots.

33 

34## Manage spend limit alerts

35 

36Use project spend alerts to notify your team when project spend reaches a threshold. Threshold amounts are specified in cents.

37 

38## Manage data retention

39 

40Use project data retention controls to override or inherit the organization's retention policy for a project. Set `retention_type` to `organization_default` to inherit the organization setting.

41 

27## Invite a user by email42## Invite a user by email

28 43 

29Use the Invites endpoint to send an organization invitation to an email address.44Use the Invites endpoint to send an organization invitation to an email address.

Details

1# Migrate from prompt objects

2 

3To migrate away from **Prompts** in the OpenAI API platform, move the prompt content out of the managed `prompt` object and into your application code. This gives you more control over review, testing, deployment, and versioning.

4 

5## Before: using a Prompt Object

6 

7Use a prompt object

8 

9```javascript

10import OpenAI from "openai";

11 

12const client = new OpenAI();

13 

14const response = await client.responses.create({

15 prompt: {

16 prompt_id: "pmpt_123",

17 version: "1",

18 variables: {

19 customer_name: "Acme",

20 issue: "billing question",

21 },

22 },

23});

24```

25 

26```python

27from openai import OpenAI

28 

29client = OpenAI()

30 

31response = client.responses.create(

32 prompt={

33 "prompt_id": "pmpt_123",

34 "version": "1",

35 "variables": {

36 "customer_name": "Acme",

37 "issue": "billing question",

38 },

39 }

40)

41```

42 

43```bash

44curl https://api.openai.com/v1/responses \\

45 -H "Content-Type: application/json" \\

46 -H "Authorization: Bearer $OPENAI_API_KEY" \\

47 -d '{

48 "prompt": {

49 "prompt_id": "pmpt_123",

50 "version": "1",

51 "variables": {

52 "customer_name": "Acme",

53 "issue": "billing question"

54 }

55 }

56 }'

57```

58 

59 

60## After: inline the prompt in code

61 

62Inline the prompt in code

63 

64```javascript

65import OpenAI from "openai";

66 

67const client = new OpenAI();

68 

69const response = await client.responses.create({

70 model: "gpt-5.1",

71 input: [

72 {

73 role: "system",

74 content:

75 "You are a helpful support assistant. Be concise, accurate, and friendly.",

76 },

77 {

78 role: "user",

79 content: \`

80Customer name: Acme

81Issue: billing question

82 

83Write a response to the customer.

84 \`.trim(),

85 },

86 ],

87});

88 

89console.log(response.output_text);

90```

91 

92```python

93from openai import OpenAI

94 

95client = OpenAI()

96 

97response = client.responses.create(

98 model="gpt-5.1",

99 input=[

100 {

101 "role": "system",

102 "content": "You are a helpful support assistant. Be concise, accurate, and friendly.",

103 },

104 {

105 "role": "user",

106 "content": """

107Customer name: Acme

108Issue: billing question

109 

110Write a response to the customer.

111 """.strip(),

112 },

113 ],

114)

115 

116print(response.output_text)

117```

118 

119```bash

120curl https://api.openai.com/v1/responses \\

121 -H "Content-Type: application/json" \\

122 -H "Authorization: Bearer $OPENAI_API_KEY" \\

123 -d '{

124 "model": "gpt-5.1",

125 "input": [

126 {

127 "role": "system",

128 "content": "You are a helpful support assistant. Be concise, accurate, and friendly."

129 },

130 {

131 "role": "user",

132 "content": "Customer name: Acme\\nIssue: billing question\\n\\nWrite a response to the customer."

133 }

134 ]

135 }'

136```

137 

138 

139## Use Codex to migrate

140 

141Use the [OpenAI Developers plugin](https://developers.openai.com/learn/developers-codex-plugin) and [OpenAI Docs skill](https://github.com/openai/skills/tree/main/skills/.curated/openai-docs) to automate your migration and accelerate building with the OpenAI API.

142 

143```text

144$openai-docs update this project to store prompts in code instead of using a prompts object

145```

146 

147## What changes

148 

149Instead of referencing a saved prompt object from an API request, store the prompt text in your codebase and pass the generated messages directly as `input` in the Responses API call.

150 

151- **Move prompt content into source code** so prompt changes go through the same review and release process as product logic.

152- **Replace prompt variables with function arguments** so dynamic values are explicit and typed in your application.

153- **Pass messages through `input`** in the Responses API call instead of using the `prompt` object.

154- **Move versioning to your repo** using git commits, PR review, and tests or evals.

155- **Keep static content first and dynamic content later** to preserve prompt caching benefits, since cache hits depend on exact prefix matches.

156 

157## Example

158 

159Build prompts with a helper function

160 

161```javascript

162import OpenAI from "openai";

163 

164const client = new OpenAI();

165 

166function buildSupportPrompt({ customerName, issue }) {

167 return [

168 {

169 role: "system",

170 content: \`

171You are a helpful support assistant.

172Be concise, accurate, and friendly.

173Do not invent policy details.

174 \`.trim(),

175 },

176 {

177 role: "user",

178 content: \`

179Customer name: \${customerName}

180Issue: \${issue}

181 

182Write a response to the customer.

183 \`.trim(),

184 },

185 ];

186}

187 

188const response = await client.responses.create({

189 model: "gpt-5.1",

190 input: buildSupportPrompt({

191 customerName: "Acme",

192 issue: "billing question",

193 }),

194});

195```

196 

197```python

198from openai import OpenAI

199 

200client = OpenAI()

201 

202def build_support_prompt(customer_name, issue):

203 return [

204 {

205 "role": "system",

206 "content": """

207You are a helpful support assistant.

208Be concise, accurate, and friendly.

209Do not invent policy details.

210 """.strip(),

211 },

212 {

213 "role": "user",

214 "content": f"""

215Customer name: {customer_name}

216Issue: {issue}

217 

218Write a response to the customer.

219 """.strip(),

220 },

221 ]

222 

223response = client.responses.create(

224 model="gpt-5.1",

225 input=build_support_prompt(

226 customer_name="Acme",

227 issue="billing question",

228 ),

229)

230```

231 

232 

233## What you gain

234 

235You get tighter engineering control: prompts live with the product code, changes go through PRs, tests and evals can run in CI, and rollout or experimentation can be managed through your own config or feature flags.

236 

237Don't scatter prompts inline across the codebase. Create a small `prompts/` module, keep each prompt as a named builder function, and add lightweight eval fixtures so prompt changes are reviewed like product logic.

Details

75 75 

76Keep `tunnel-client run ...` healthy while you create or test the connector. Connector discovery and MCP tool calls depend on the running client.76Keep `tunnel-client run ...` healthy while you create or test the connector. Connector discovery and MCP tool calls depend on the running client.

77 77 

78<figure className="not-prose my-8">

79 <figcaption className="mt-3 text-sm text-gray-600 dark:text-gray-400">

80 The local admin UI at <code>/ui</code> shows whether the running client is

81 healthy, ready, and connected before you test from ChatGPT, Codex, or an API

82 flow.

83 </figcaption>

84</figure>

85 

78## Choose where to run tunnel-client86## Choose where to run tunnel-client

79 87 

80Run `tunnel-client` in the same trust boundary that can already reach the private MCP server. Common deployment patterns are:88Run `tunnel-client` in the same trust boundary that can already reach the private MCP server. Common deployment patterns are: