Is tool calling available in all AI APIs?
Which APIs support tool calling
Major AI providers like OpenAI, Anthropic, Google, and Cohere offer tool calling in their APIs, though the exact feature name and implementation vary. For example, OpenAI calls it 'function calling' or 'tools', Anthropic uses 'tools', and Google Gemini has 'function calling'.
Some open-source model APIs also support it, especially if the model was fine-tuned for tool use. However, smaller or older models may lack this capability entirely.
Why it's not universal
Tool calling requires the model to be trained to output structured calls, which is an additional capability beyond text generation. Not all models are trained for this, especially older or smaller ones.
Additionally, some APIs are designed for specific tasks like text completion or embeddings and don't include tool calling. Even within a provider, only certain models may support it (e.g., GPT-4 but not older GPT-3 models).
- OpenAI: GPT-4, GPT-3.5 Turbo, and newer models support tools.
- Anthropic: Claude 3 models support tools.
- Google: Gemini models support function calling.
- Cohere: Command models support tool use.
- Open-source: varies by model; check documentation.
How to check if an API supports tool calling
Look at the API documentation for the model you plan to use. Search for terms like 'function calling', 'tool use', or 'tools'. If it's not mentioned, it likely doesn't support it.
You can also test by sending a request with tool definitions and seeing if the model returns a tool call. If it ignores them or returns plain text, tool calling may not be supported.
Common mistakes
- Assuming all models from a provider support tool calling; often only specific models do.
- Confusing tool calling with other features like structured output or JSON mode, which are different.
- Thinking that if an API supports tools, it works identically across providers; syntax and behavior vary.