Skip to content

add openai responses api #415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions fern/sdk/mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,52 @@ The Vapi MCP Server exposes these actions as MCP tools:
```

</Tab>
<Tab title="OpenAI responses API">
<Note>
The OpenAI <code>responses</code> API now supports MCP. <a href="https://platform.openai.com/docs/guides/tools-remote-mcp#page-top" target="_blank" rel="noopener">Read more here</a>.
</Note>
<CodeBlocks>
```typescript title="typescript"
import OpenAI from 'openai';
// Replace with your actual OpenAI API key
const openai = new OpenAI({ apiKey: 'YOUR_OPENAI_API_KEY' });
async function main() {
const response = await openai.responses.create({
model: 'gpt-4.1',
tools: [
{
type: 'mcp',
server_label: 'vapi-mcp',
server_url: 'https://mcp.vapi.ai/mcp',
headers: { "Authorization": "Bearer YOUR_VAPI_API_KEY" }
},
],
input: 'What vapi tools do you have available?',
});
console.dir(response, { depth: null });
}
main();
```
```python title="python"
import openai
# Replace with your actual OpenAI API key
openai.api_key = 'YOUR_OPENAI_API_KEY'
response = openai.responses.create(
model="gpt-4.1",
tools=[
{
"type": "mcp",
"server_label": "vapi-mcp",
"server_url": "https://mcp.vapi.ai/mcp",
"headers": {"Authorization": "Bearer YOUR_VAPI_API_KEY"}
},
],
input="What vapi tools do you have available?",
)
print(response)
```
</CodeBlocks>
</Tab>
<Tab title="Local">
Run the MCP server on your own machine for development or testing.

Expand Down
Loading