AI Application Programming Interfaces

Food for Thought

Posted by dave on May 06, 2025

It is premature to declare a winner in the AI API battle. OpenAI was the first mover and holds high ground, for the moment. All LLM vendors are trying hard to overthrow them. Each is developing their own enhanced API to keep pace with LLM advancements. Anthropic and MCP are strong contenders but OpenAI is forging ahead. Time will tell…

In the meantime, the current industry standard API is the OpenAI Chat Completions API with function calling tool support. Most, if not all, current models, are trained on and support function calling tools using the OpenAI API library. (Below is a list of models I have worked with.) In addition, all API's seem to support some form of function calling using JSON. The JSON function definitions and descriptions are used by the LLM to understand what the function is and how to call it.

Suggestion: Define a set of python-friendly functions that interface with a target system such as an OPCUA Server. These functions would form a core base set of functionality that can be built upon as LLMs and the API landscape matures and becomes clearer. The local Python function implementation is open and can delegate as needed. Function call tools are not going away. These functions represent low hanging fruit and can basically encapsulate the API of the target system.

Models with Function Calling Tool Support

"gpt-4.1", 
"04-mini", 
"O3", 
"grok-3-mini-beta", 
"gemini-2.5-pro-exp-03-25", 
"gpt-4.5-preview", 
"llama-4-scout-17b-16e-instruct",
"claude-3-7-sonnet-20250219 (claude-3-7-sonnet-latest)",
"deepseek-chat",
"phi-4",
"openmath-nemotron-32b",
"openmath-nemotron-14b",
"qwen3-32b",

Current API Contestants (A Moving Target)

OpenAI Chat Completions vs Responses API

Statement from OpenAI

The Chat Completions API is an industry standard for building AI applications, and we intend to continue supporting this API indefinitely. We're introducing the Responses API to simplify workflows involving tool use, code execution, and state management. We believe this new API primitive will allow us to more effectively enhance the OpenAI platform into the future.

OpenAI Function Calling Tool

https://platform.openai.com/docs/guides/function-calling?api-mode=responses

from openai import OpenAI

client = OpenAI()

tools = [{
    "type": "function",
    "name": "get_weather",
    "description": "Get current temperature for a given location.",
    "parameters": {
        "type": "object",
        "properties": {
            "location": {
                "type": "string",
                "description": "City and country e.g. Bogotá, Colombia"
            }
        },
        "required": [
            "location"
        ],
        "additionalProperties": False
    }
}]

response = client.responses.create(
    model="gpt-4.1",
    input=[{"role": "user", "content": "What is the weather like in Paris today?"}],
    tools=tools
)

print(response.output)


[{
    "type": "function_call",
    "id": "fc_12345xyz",
    "call_id": "call_12345xyz",
    "name": "get_weather",
    "arguments": "{\"location\":\"Paris, France\"}"
}]

Sample Function Call

{
            "type": "function",
            "function": {
            "name": "sendGridPeakDetected",
            "description": "Send a grid peak detected to a destination network node.",
            "parameters": {
                "type": "object",
                "properties": {
                "network_node": {"type": "string", "description": "The name of a node on the network. Network node names include C2Agent, AlarmPanel, ControlPanel, NoticePanel, AlertPanel, CommandCenter."},
                "message": {"type": "string", "description": "The description of the peak detected."},
                "start_date_time": {"type": "string", "description": "The datetime of the peak detected. Datetime in the format 'YYYY-MM-DD HH:MM:SS', e.g., '2025-05-02 10:30:00'"},
                "duration_mins": {"type": "string", "description": "The duration in minutes of the peak detected."},
                "peak_lmp": {"type": "string", "description": "The LMP for a megawatt-hour during the peak detected."},
                "grid_node": {"type": "string", "description": "The grid pricing node for the peak detected ."},
                "award_level": {"type": "string", "description": "The award level of the game. Values can be BRONZE, SILVER and GOLD"},
                "game_type": {"type": "string", "description": "The type of game that is being played. The values can be SHEDPOWER or HARVESTPOWER"},
                },
                "required": ["network_node", "message","start_date_time","duration_mins","peak_lmp","grid_node","award_level","game_type"]
            }
            } 
        }