OpenAI Providers

The OpenAI Provider is the default provider for the Composio SDK. It transforms Composio tools into a format compatible with OpenAI’s function calling capabilities through both the Responses and Chat Completion APIs.

Setup

By default, the OpenAI Provider is installed when you install the Composio SDK. You can also install it manually:

$pip install composio_openai==1.0.0rc9

The OpenAI Provider is used by default when you initialize the Composio SDK but you can explicitly specify it.

1from openai import OpenAI
2from composio import Composio
3from composio_openai import OpenAIProvider
4
5# Initialize Composio client with OpenAI Provider
6composio = Composio(provider=OpenAIProvider())
7openai = OpenAI()

Responses API

The Responses API is the recommended way to build more agentic flows with the OpenAI API. Read more about it in the OpenAI documentation

1

Chat Completion API

Chat Completion API is the industry standard for building LLM-powered applications. Chat completions are also adopted and used by many other LLM providers apart from OpenAI.

1tools = composio.tools.get(user_id=user_id, toolkits=["HACKERNEWS"])
2
3response = openai.chat.completions.create(
4 model="gpt-4.1",
5 tools=tools,
6 messages=[
7 {"role": "user", "content": "What's the latest Hackernews post about?"},
8 ],
9)
10
11# Execute the function calls.
12result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
13print(result)
14# will return the raw response from the HACKERNEWS API.

Modifiers

Modifiers are functions that can be used to intercept and optionally modify the schema, the tool call request and the response from the tool call.

OpenAI provider modifiers are the standard framework modifiers. Read more here: Framework Modifiers