SpyBara
Go Premium

Documentation 2026-04-14 05:55 UTC to 2026-04-15 05:55 UTC

4 files changed +3 −681. View all changes and history on the product overview
2026
Thu 30 06:13 Tue 28 06:15 Sat 25 05:52 Fri 24 05:58 Thu 23 05:56 Wed 22 05:55 Thu 16 05:55 Wed 15 05:55 Tue 14 05:55 Sat 11 05:41 Thu 9 05:52 Wed 8 05:51 Tue 7 05:51 Wed 1 05:53

bots.md +1 −0

Details

6 | User agent | Description & details |6 | User agent | Description & details |

7 | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |7 | ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |

8 | OAI-SearchBot | OAI-SearchBot is for search. OAI-SearchBot is used to surface websites in search results in ChatGPT's search features. Sites that are opted out of OAI-SearchBot will not be shown in ChatGPT search answers, though can still appear as navigational links. To help ensure your site appears in search results, we recommend allowing OAI-SearchBot in your site’s robots.txt file and allowing requests from our published IP ranges below. <br/><br/>Full user-agent string: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.3; +https://openai.com/searchbot` <br/><br/>Published IP addresses: https://openai.com/searchbot.json8 | OAI-SearchBot | OAI-SearchBot is for search. OAI-SearchBot is used to surface websites in search results in ChatGPT's search features. Sites that are opted out of OAI-SearchBot will not be shown in ChatGPT search answers, though can still appear as navigational links. To help ensure your site appears in search results, we recommend allowing OAI-SearchBot in your site’s robots.txt file and allowing requests from our published IP ranges below. <br/><br/>Full user-agent string: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36; compatible; OAI-SearchBot/1.3; +https://openai.com/searchbot` <br/><br/>Published IP addresses: https://openai.com/searchbot.json

9 | OAI-AdsBot | OAI-AdsBot is used to validate the safety of web pages submitted as ads on ChatGPT. When you submit an ad, OpenAI may visit the landing page to ensure it complies with our policies. We may also use content from the landing page to determine when it's most relevant to show the ad to users. OAI-AdsBot only visits pages submitted as ads, and the data collected by OAI-AdsBot is not used to train generative AI foundation models. <br/><br/>Full user-agent string: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; OAI-AdsBot/1.0; +https://openai.com/adsbot`

9 | GPTBot | GPTBot is used to make our generative AI foundation models more useful and safe. It is used to crawl content that may be used in training our generative AI foundation models. Disallowing GPTBot indicates a site’s content should not be used in training generative AI foundation models. <br/><br/>Full user-agent string: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.3; +https://openai.com/gptbot` <br/><br/>Published IP addresses: https://openai.com/gptbot.json10 | GPTBot | GPTBot is used to make our generative AI foundation models more useful and safe. It is used to crawl content that may be used in training our generative AI foundation models. Disallowing GPTBot indicates a site’s content should not be used in training generative AI foundation models. <br/><br/>Full user-agent string: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; GPTBot/1.3; +https://openai.com/gptbot` <br/><br/>Published IP addresses: https://openai.com/gptbot.json

10 | ChatGPT-User | OpenAI also uses ChatGPT-User for certain user actions in ChatGPT and [Custom GPTs](https://openai.com/index/introducing-gpts/). When users ask ChatGPT or a CustomGPT a question, it may visit a web page with a ChatGPT-User agent. ChatGPT users may also interact with external applications via [GPT Actions](https://developers.openai.com/api/docs/actions/introduction). ChatGPT-User is not used for crawling the web in an automatic fashion. Because these actions are initiated by a user, robots.txt rules may not apply. ChatGPT-User is not used to determine whether content may appear in Search. Please use OAI-SearchBot in robots.txt for managing Search opt outs and automatic crawl. <br/><br/>Full user-agent string: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot` <br/><br/>Published IP addresses: https://openai.com/chatgpt-user.json11 | ChatGPT-User | OpenAI also uses ChatGPT-User for certain user actions in ChatGPT and [Custom GPTs](https://openai.com/index/introducing-gpts/). When users ask ChatGPT or a CustomGPT a question, it may visit a web page with a ChatGPT-User agent. ChatGPT users may also interact with external applications via [GPT Actions](https://developers.openai.com/api/docs/actions/introduction). ChatGPT-User is not used for crawling the web in an automatic fashion. Because these actions are initiated by a user, robots.txt rules may not apply. ChatGPT-User is not used to determine whether content may appear in Search. Please use OAI-SearchBot in robots.txt for managing Search opt outs and automatic crawl. <br/><br/>Full user-agent string: `Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot` <br/><br/>Published IP addresses: https://openai.com/chatgpt-user.json

11 12 

Details

67 67 

68 68 

69 69 

70 Complete tool calling example70 Note that for reasoning models like GPT-5 or o4-mini, any reasoning items

71 

72```python

73from openai import OpenAI

74import json

75 

76client = OpenAI()

77 

78# 1. Define a list of callable tools for the model

79tools = [

80 {

81 "type": "function",

82 "name": "get_horoscope",

83 "description": "Get today's horoscope for an astrological sign.",

84 "parameters": {

85 "type": "object",

86 "properties": {

87 "sign": {

88 "type": "string",

89 "description": "An astrological sign like Taurus or Aquarius",

90 },

91 },

92 "required": ["sign"],

93 },

94 },

95]

96 

97def get_horoscope(sign):

98 return f"{sign}: Next Tuesday you will befriend a baby otter."

99 

100# Create a running input list we will add to over time

101input_list = [

102 {"role": "user", "content": "What is my horoscope? I am an Aquarius."}

103]

104 

105# 2. Prompt the model with tools defined

106response = client.responses.create(

107 model="gpt-5",

108 tools=tools,

109 input=input_list,

110)

111 

112# Save function call outputs for subsequent requests

113input_list += response.output

114 

115for item in response.output:

116 if item.type == "function_call":

117 if item.name == "get_horoscope":

118 # 3. Execute the function logic for get_horoscope

119 sign = json.loads(item.arguments)["sign"]

120 horoscope = get_horoscope(sign)

121

122 # 4. Provide function call results to the model

123 input_list.append({

124 "type": "function_call_output",

125 "call_id": item.call_id,

126 "output": horoscope,

127 })

128 

129print("Final input:")

130print(input_list)

131 

132response = client.responses.create(

133 model="gpt-5",

134 instructions="Respond only with a horoscope generated by a tool.",

135 tools=tools,

136 input=input_list,

137)

138 

139# 5. The model should be able to give a response!

140print("Final output:")

141print(response.model_dump_json(indent=2))

142print("\\n" + response.output_text)

143```

144 

145```javascript

146import OpenAI from "openai";

147 

148const openai = new OpenAI();

149 

150// 1. Define a list of callable tools for the model

151const tools = [

152 {

153 type: "function",

154 name: "get_horoscope",

155 description: "Get today's horoscope for an astrological sign.",

156 parameters: {

157 type: "object",

158 properties: {

159 sign: {

160 type: "string",

161 description: "An astrological sign like Taurus or Aquarius",

162 },

163 },

164 required: ["sign"],

165 additionalProperties: false,

166 },

167 strict: true,

168 },

169];

170 

171function getHoroscope(sign) {

172 return \`\${sign}: Next Tuesday you will befriend a baby otter.\`;

173}

174 

175// Create a running input list we will add to over time

176let input = [

177 { role: "user", content: "What is my horoscope? I am an Aquarius." },

178];

179 

180// 2. Prompt the model with tools defined

181let response = await openai.responses.create({

182 model: "gpt-5",

183 tools,

184 input,

185});

186 

187// Preserve model output for the next turn

188input.push(...response.output);

189 

190for (const item of response.output) {

191 if (item.type !== "function_call") continue;

192 

193 if (item.name === "get_horoscope") {

194 // 3. Execute the function logic for get_horoscope

195 const { sign } = JSON.parse(item.arguments);

196 const horoscope = getHoroscope(sign);

197 

198 // 4. Provide function call results to the model

199 input.push({

200 type: "function_call_output",

201 call_id: item.call_id,

202 output: horoscope,

203 });

204 }

205}

206 

207console.log("Final input:");

208console.log(JSON.stringify(input, null, 2));

209 

210response = await openai.responses.create({

211 model: "gpt-5",

212 instructions: "Respond only with a horoscope generated by a tool.",

213 tools,

214 input,

215});

216 

217// 5. The model should be able to give a response!

218console.log("Final output:");

219console.log(response.output_text);

220```

221 

222 

223 

224Note that for reasoning models like GPT-5 or o4-mini, any reasoning items

225 returned in model responses with tool calls must also be passed back with tool71 returned in model responses with tool calls must also be passed back with tool

226 call outputs.72 call outputs.

227 73 


509 355 

510The following code sample shows creating a custom tool that expects to receive a string of text containing Python code as a response.356The following code sample shows creating a custom tool that expects to receive a string of text containing Python code as a response.

511 357 

512Custom tool calling example

513 

514```python

515from openai import OpenAI

516 

517client = OpenAI()

518 

519response = client.responses.create(

520 model="gpt-5",

521 input="Use the code_exec tool to print hello world to the console.",

522 tools=[

523 {

524 "type": "custom",

525 "name": "code_exec",

526 "description": "Executes arbitrary Python code.",

527 }

528 ]

529)

530print(response.output)

531```

532 

533```javascript

534import OpenAI from "openai";

535const client = new OpenAI();

536 

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

538 model: "gpt-5",

539 input: "Use the code_exec tool to print hello world to the console.",

540 tools: [

541 {

542 type: "custom",

543 name: "code_exec",

544 description: "Executes arbitrary Python code.",

545 },

546 ],

547});

548 

549console.log(response.output);

550```

551 

552 

553Just as before, the `output` array will contain a tool call generated by the model. Except this time, the tool call input is given as plain text.358Just as before, the `output` array will contain a tool call generated by the model. Except this time, the tool call input is given as plain text.

554 359 

555```json360```json


579 384 

580#### Lark CFG385#### Lark CFG

581 386 

582Lark context free grammar example

583 

584```python

585from openai import OpenAI

586 

587client = OpenAI()

588 

589grammar = """

590start: expr

591expr: term (SP ADD SP term)* -> add

592| term

593term: factor (SP MUL SP factor)* -> mul

594| factor

595factor: INT

596SP: " "

597ADD: "+"

598MUL: "*"

599%import common.INT

600"""

601 

602response = client.responses.create(

603 model="gpt-5",

604 input="Use the math_exp tool to add four plus four.",

605 tools=[

606 {

607 "type": "custom",

608 "name": "math_exp",

609 "description": "Creates valid mathematical expressions",

610 "format": {

611 "type": "grammar",

612 "syntax": "lark",

613 "definition": grammar,

614 },

615 }

616 ]

617)

618print(response.output)

619```

620 

621```javascript

622import OpenAI from "openai";

623const client = new OpenAI();

624 

625const grammar = \`

626start: expr

627expr: term (SP ADD SP term)* -> add

628| term

629term: factor (SP MUL SP factor)* -> mul

630| factor

631factor: INT

632SP: " "

633ADD: "+"

634MUL: "*"

635%import common.INT

636\`;

637 

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

639 model: "gpt-5",

640 input: "Use the math_exp tool to add four plus four.",

641 tools: [

642 {

643 type: "custom",

644 name: "math_exp",

645 description: "Creates valid mathematical expressions",

646 format: {

647 type: "grammar",

648 syntax: "lark",

649 definition: grammar,

650 },

651 },

652 ],

653});

654 

655console.log(response.output);

656```

657 

658 

659The output from the tool should then conform to the Lark CFG that you defined:387The output from the tool should then conform to the Lark CFG that you defined:

660 388 

661```json389```json


764 492 

765#### Regex CFG493#### Regex CFG

766 494 

767Regex context free grammar example

768 

769```python

770from openai import OpenAI

771 

772client = OpenAI()

773 

774grammar = r"^(?P<month>January|February|March|April|May|June|July|August|September|October|November|December)\\s+(?P<day>\\d{1,2})(?:st|nd|rd|th)?\\s+(?P<year>\\d{4})\\s+at\\s+(?P<hour>0?[1-9]|1[0-2])(?P<ampm>AM|PM)$"

775 

776response = client.responses.create(

777 model="gpt-5",

778 input="Use the timestamp tool to save a timestamp for August 7th 2025 at 10AM.",

779 tools=[

780 {

781 "type": "custom",

782 "name": "timestamp",

783 "description": "Saves a timestamp in date + time in 24-hr format.",

784 "format": {

785 "type": "grammar",

786 "syntax": "regex",

787 "definition": grammar,

788 },

789 }

790 ]

791)

792print(response.output)

793```

794 

795```javascript

796import OpenAI from "openai";

797const client = new OpenAI();

798 

799const grammar = "^(?P<month>January|February|March|April|May|June|July|August|September|October|November|December)\\s+(?P<day>\\d{1,2})(?:st|nd|rd|th)?\\s+(?P<year>\\d{4})\\s+at\\s+(?P<hour>0?[1-9]|1[0-2])(?P<ampm>AM|PM)$";

800 

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

802 model: "gpt-5",

803 input: "Use the timestamp tool to save a timestamp for August 7th 2025 at 10AM.",

804 tools: [

805 {

806 type: "custom",

807 name: "timestamp",

808 description: "Saves a timestamp in date + time in 24-hr format.",

809 format: {

810 type: "grammar",

811 syntax: "regex",

812 definition: grammar,

813 },

814 },

815 ],

816});

817 

818console.log(response.output);

819```

820 

821 

822The output from the tool should then conform to the Regex CFG that you defined:495The output from the tool should then conform to the Regex CFG that you defined:

823 496 

824```json497```json

Details

89- See [image and file inputs](#image-and-file-inputs).89- See [image and file inputs](#image-and-file-inputs).

90- MCP servers (used with the [remote MCP server tool](https://developers.openai.com/api/docs/guides/tools-remote-mcp)) are third-party services, and data sent to an MCP server is subject to their data retention policies.90- MCP servers (used with the [remote MCP server tool](https://developers.openai.com/api/docs/guides/tools-remote-mcp)) are third-party services, and data sent to an MCP server is subject to their data retention policies.

91- Hosted containers used by [Hosted Shell](https://developers.openai.com/api/docs/guides/tools-shell#hosted-shell-quickstart) and [Code Interpreter](https://developers.openai.com/api/docs/guides/tools-code-interpreter) may write temporary application state to the container filesystem (backed by ephemeral block storage) while the container is active. Container data is deleted when the container expires or is explicitly deleted.91- Hosted containers used by [Hosted Shell](https://developers.openai.com/api/docs/guides/tools-shell#hosted-shell-quickstart) and [Code Interpreter](https://developers.openai.com/api/docs/guides/tools-code-interpreter) may write temporary application state to the container filesystem (backed by ephemeral block storage) while the container is active. Container data is deleted when the container expires or is explicitly deleted.

92- Extended prompt caching requires storing key/value tensors to GPU-local storage as application state. This storage requirement means that requests leveraging extended prompt caching are not Zero Data Retention eligible. To learn more, see the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention).92- Extended prompt caching requires storing key/value tensors to GPU-local storage as application state. This data is only stored on the local GPU machines and is not retained after the cache expires. To learn more, see the [prompt caching guide](https://developers.openai.com/api/docs/guides/prompt-caching#prompt-cache-retention).

93- For server-side compaction, no data is retained when `store="false"`.93- For server-side compaction, no data is retained when `store="false"`.

94- We support [Skills](https://developers.openai.com/api/docs/guides/tools-skills) in two form factors, both local execution and hosted container-based execution. Hosted skills follow the same container lifecycle as hosted shell: mounted skills and container files remain available while the container is active and are discarded when the container expires or is deleted.94- We support [Skills](https://developers.openai.com/api/docs/guides/tools-skills) in two form factors, both local execution and hosted container-based execution. Hosted skills follow the same container lifecycle as hosted shell: mounted skills and container files remain available while the container is active and are discarded when the container expires or is deleted.

95- Data transmitted to third-party services over network connections is subject to their data retention policies.95- Data transmitted to third-party services over network connections is subject to their data retention policies.

quickstart.md +0 −352

Details

184 </div>184 </div>

185 <div data-content-switcher-pane data-value="file-url" hidden>185 <div data-content-switcher-pane data-value="file-url" hidden>

186 <div class="hidden">File URL</div>186 <div class="hidden">File URL</div>

187 Use a file URL as input

188 

189```bash

190curl "https://api.openai.com/v1/responses" \\

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

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

193 -d '{

194 "model": "gpt-5",

195 "input": [

196 {

197 "role": "user",

198 "content": [

199 {

200 "type": "input_text",

201 "text": "Analyze the letter and provide a summary of the key points."

202 },

203 {

204 "type": "input_file",

205 "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf"

206 }

207 ]

208 }

209 ]

210 }'

211```

212 

213```javascript

214import OpenAI from "openai";

215const client = new OpenAI();

216 

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

218 model: "gpt-5",

219 input: [

220 {

221 role: "user",

222 content: [

223 {

224 type: "input_text",

225 text: "Analyze the letter and provide a summary of the key points.",

226 },

227 {

228 type: "input_file",

229 file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf",

230 },

231 ],

232 },

233 ],

234});

235 

236console.log(response.output_text);

237```

238 

239```python

240from openai import OpenAI

241client = OpenAI()

242 

243response = client.responses.create(

244 model="gpt-5",

245 input=[

246 {

247 "role": "user",

248 "content": [

249 {

250 "type": "input_text",

251 "text": "Analyze the letter and provide a summary of the key points.",

252 },

253 {

254 "type": "input_file",

255 "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf",

256 },

257 ],

258 },

259 ]

260)

261 

262print(response.output_text)

263```

264 

265```csharp

266using OpenAI.Files;

267using OpenAI.Responses;

268 

269string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

270OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);

271 

272using HttpClient http = new();

273using Stream stream = await http.GetStreamAsync("https://www.berkshirehathaway.com/letters/2024ltr.pdf");

274OpenAIFileClient files = new(key);

275OpenAIFile file = files.UploadFile(stream, "2024ltr.pdf", FileUploadPurpose.UserData);

276 

277OpenAIResponse response = (OpenAIResponse)client.CreateResponse([

278 ResponseItem.CreateUserMessageItem([

279 ResponseContentPart.CreateInputTextPart("Analyze the letter and provide a summary of the key points."),

280 ResponseContentPart.CreateInputFilePart(file.Id),

281 ]),

282]);

283 

284Console.WriteLine(response.GetOutputText());

285```

286 

287 </div>187 </div>

288 <div data-content-switcher-pane data-value="file-upload" hidden>188 <div data-content-switcher-pane data-value="file-upload" hidden>

289 <div class="hidden">Upload file</div>189 <div class="hidden">Upload file</div>

290 Upload a file and use it as input

291 

292```bash

293curl https://api.openai.com/v1/files \\

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

295 -F purpose="user_data" \\

296 -F file="@draconomicon.pdf"

297 

298curl "https://api.openai.com/v1/responses" \\

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

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

301 -d '{

302 "model": "gpt-5",

303 "input": [

304 {

305 "role": "user",

306 "content": [

307 {

308 "type": "input_file",

309 "file_id": "file-6F2ksmvXxt4VdoqmHRw6kL"

310 },

311 {

312 "type": "input_text",

313 "text": "What is the first dragon in the book?"

314 }

315 ]

316 }

317 ]

318 }'

319```

320 

321```javascript

322import fs from "fs";

323import OpenAI from "openai";

324const client = new OpenAI();

325 

326const file = await client.files.create({

327 file: fs.createReadStream("draconomicon.pdf"),

328 purpose: "user_data",

329});

330 

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

332 model: "gpt-5",

333 input: [

334 {

335 role: "user",

336 content: [

337 {

338 type: "input_file",

339 file_id: file.id,

340 },

341 {

342 type: "input_text",

343 text: "What is the first dragon in the book?",

344 },

345 ],

346 },

347 ],

348});

349 

350console.log(response.output_text);

351```

352 

353```python

354from openai import OpenAI

355client = OpenAI()

356 

357file = client.files.create(

358 file=open("draconomicon.pdf", "rb"),

359 purpose="user_data"

360)

361 

362response = client.responses.create(

363 model="gpt-5",

364 input=[

365 {

366 "role": "user",

367 "content": [

368 {

369 "type": "input_file",

370 "file_id": file.id,

371 },

372 {

373 "type": "input_text",

374 "text": "What is the first dragon in the book?",

375 },

376 ]

377 }

378 ]

379)

380 

381print(response.output_text)

382```

383 

384```csharp

385using OpenAI.Files;

386using OpenAI.Responses;

387 

388string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

389OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);

390 

391OpenAIFileClient files = new(key);

392OpenAIFile file = files.UploadFile("draconomicon.pdf", FileUploadPurpose.UserData);

393 

394OpenAIResponse response = (OpenAIResponse)client.CreateResponse([

395 ResponseItem.CreateUserMessageItem([

396 ResponseContentPart.CreateInputFilePart(file.Id),

397 ResponseContentPart.CreateInputTextPart("What is the first dragon in the book?"),

398 ]),

399]);

400 

401Console.WriteLine(response.GetOutputText());

402```

403 

404 </div>190 </div>

405 191 

406 192 


432 </div>218 </div>

433 <div data-content-switcher-pane data-value="file-search" hidden>219 <div data-content-switcher-pane data-value="file-search" hidden>

434 <div class="hidden">File search</div>220 <div class="hidden">File search</div>

435 Search your files in a response

436 

437```python

438from openai import OpenAI

439client = OpenAI()

440 

441response = client.responses.create(

442 model="gpt-4.1",

443 input="What is deep research by OpenAI?",

444 tools=[{

445 "type": "file_search",

446 "vector_store_ids": ["<vector_store_id>"]

447 }]

448)

449print(response)

450```

451 

452```javascript

453import OpenAI from "openai";

454const openai = new OpenAI();

455 

456const response = await openai.responses.create({

457 model: "gpt-4.1",

458 input: "What is deep research by OpenAI?",

459 tools: [

460 {

461 type: "file_search",

462 vector_store_ids: ["<vector_store_id>"],

463 },

464 ],

465});

466console.log(response);

467```

468 

469```csharp

470using OpenAI.Responses;

471 

472string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

473OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);

474 

475ResponseCreationOptions options = new();

476options.Tools.Add(ResponseTool.CreateFileSearchTool(["<vector_store_id>"]));

477 

478OpenAIResponse response = (OpenAIResponse)client.CreateResponse([

479 ResponseItem.CreateUserMessageItem([

480 ResponseContentPart.CreateInputTextPart("What is deep research by OpenAI?"),

481 ]),

482], options);

483 

484Console.WriteLine(response.GetOutputText());

485```

486 

487 </div>221 </div>

488 <div data-content-switcher-pane data-value="function-calling" hidden>222 <div data-content-switcher-pane data-value="function-calling" hidden>

489 <div class="hidden">Function calling</div>223 <div class="hidden">Function calling</div>

490 </div>224 </div>

491 <div data-content-switcher-pane data-value="remote-mcp" hidden>225 <div data-content-switcher-pane data-value="remote-mcp" hidden>

492 <div class="hidden">Remote MCP</div>226 <div class="hidden">Remote MCP</div>

493 Call a remote MCP server

494 

495```bash

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

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

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

499-d '{

500 "model": "gpt-5",

501 "tools": [

502 {

503 "type": "mcp",

504 "server_label": "dmcp",

505 "server_description": "A Dungeons and Dragons MCP server to assist with dice rolling.",

506 "server_url": "https://dmcp-server.deno.dev/sse",

507 "require_approval": "never"

508 }

509 ],

510 "input": "Roll 2d4+1"

511 }'

512```

513 

514```javascript

515import OpenAI from "openai";

516const client = new OpenAI();

517 

518const resp = await client.responses.create({

519 model: "gpt-5",

520 tools: [

521 {

522 type: "mcp",

523 server_label: "dmcp",

524 server_description: "A Dungeons and Dragons MCP server to assist with dice rolling.",

525 server_url: "https://dmcp-server.deno.dev/sse",

526 require_approval: "never",

527 },

528 ],

529 input: "Roll 2d4+1",

530});

531 

532console.log(resp.output_text);

533```

534 

535```python

536from openai import OpenAI

537 

538client = OpenAI()

539 

540resp = client.responses.create(

541 model="gpt-5",

542 tools=[

543 {

544 "type": "mcp",

545 "server_label": "dmcp",

546 "server_description": "A Dungeons and Dragons MCP server to assist with dice rolling.",

547 "server_url": "https://dmcp-server.deno.dev/sse",

548 "require_approval": "never",

549 },

550 ],

551 input="Roll 2d4+1",

552)

553 

554print(resp.output_text)

555```

556 

557```csharp

558using OpenAI.Responses;

559 

560string key = Environment.GetEnvironmentVariable("OPENAI_API_KEY")!;

561OpenAIResponseClient client = new(model: "gpt-5", apiKey: key);

562 

563ResponseCreationOptions options = new();

564options.Tools.Add(ResponseTool.CreateMcpTool(

565 serverLabel: "dmcp",

566 serverUri: new Uri("https://dmcp-server.deno.dev/sse"),

567 toolCallApprovalPolicy: new McpToolCallApprovalPolicy(GlobalMcpToolCallApprovalPolicy.NeverRequireApproval)

568));

569 

570OpenAIResponse response = (OpenAIResponse)client.CreateResponse([

571 ResponseItem.CreateUserMessageItem([

572 ResponseContentPart.CreateInputTextPart("Roll 2d4+1")

573 ])

574], options);

575 

576Console.WriteLine(response.GetOutputText());

577```

578 

579 </div>227 </div>

580 228 

581 229