Skip to content

Create Function Call

POST https://www.kkiai.com/v1/responses

https://platform.openai.com/docs/api-reference/responses/create
Some OpenAI models only support Response format, such as o3-pro, codex-mini-latest

Request Parameters

Authorization

Add the Authorization parameter in the Header, with its value being the Token concatenated after Bearer

Example: Authorization: Bearer ********************

Header Parameters

Parameter NameTypeRequiredDescriptionExample
Content-TypestringRequiredapplication/json
AcceptstringRequiredapplication/json
AuthorizationstringOptionalBearer {{YOUR_API_KEY}}

Body Parameters (application/json)

Parameter NameTypeRequiredDescription
modelstringOptionalThe ID of the model to use. For detailed information about which models can be used with the Chat API, please refer to the model endpoint compatibility table.
inputarray[object]Optional
  └ rolestringOptional
  └ contentstringOptional

Request Example

json
{
  "input": [
    {
      "role": "user",
      "content": "Please help me complete the following tasks:\n1. Get the current system time.\n2. Check the system information, including the operating system and memory usage.\n3. Calculate the result of 123.5 + 456.7.\n4. Generate 3 random numbers between 1 and 100.\n\nThis is a parallel tool-calling test. Please execute these tasks at the same time."
    }
  ],
  "metadata": {
    "model_id": "32"
  },
  "model": "gpt-4.1",
  "tool_choice": "auto",
  "tools": [
    {
      "type": "function",
      "name": "random_generator",
      "description": "Generate random numbers within a specified range. Batch generation is supported.",
      "parameters": {
        "type": "object",
        "properties": {
          "min": {
            "description": "Minimum value. Defaults to 1.",
            "type": "integer"
          },
          "max": {
            "description": "Maximum value. Defaults to 100.",
            "type": "integer"
          },
          "count": {
            "description": "Number of random numbers to generate. Defaults to 1, with a maximum of 10.",
            "type": "integer"
          }
        }
      }
    },
    {
      "type": "function",
      "name": "system_info",
      "description": "Get basic system information, including the operating system, Java version, and memory usage.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "type": "function",
      "name": "math_calculator",
      "description": "Perform basic mathematical calculations. Supported operations include add, subtract, multiply, divide, and power.",
      "parameters": {
        "type": "object",
        "properties": {
          "a": {
            "description": "The first number.",
            "type": "number"
          },
          "b": {
            "description": "The second number.",
            "type": "number"
          },
          "operation": {
            "description": "The operation type. Supported values: add, subtract, multiply, divide, power.",
            "type": "string"
          }
        },
        "required": [
          "operation",
          "a",
          "b"
        ]
      }
    },
    {
      "type": "function",
      "name": "current_time",
      "description": "Get the current system time.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  ]
}

cURL Example

bash
curl --location --request POST 'https://www.kkiai.com/v1/responses' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "input": [
    {
      "role": "user",
      "content": "Please help me complete the following tasks:\n1. Get the current system time.\n2. Check the system information, including the operating system and memory usage.\n3. Calculate the result of 123.5 + 456.7.\n4. Generate 3 random numbers between 1 and 100.\n\nThis is a parallel tool-calling test. Please execute these tasks at the same time."
    }
  ],
  "metadata": {
    "model_id": "32"
  },
  "model": "gpt-4.1",
  "tool_choice": "auto",
  "tools": [
    {
      "type": "function",
      "name": "random_generator",
      "description": "Generate random numbers within a specified range. Batch generation is supported.",
      "parameters": {
        "type": "object",
        "properties": {
          "min": {
            "description": "Minimum value. Defaults to 1.",
            "type": "integer"
          },
          "max": {
            "description": "Maximum value. Defaults to 100.",
            "type": "integer"
          },
          "count": {
            "description": "Number of random numbers to generate. Defaults to 1, with a maximum of 10.",
            "type": "integer"
          }
        }
      }
    },
    {
      "type": "function",
      "name": "system_info",
      "description": "Get basic system information, including the operating system, Java version, and memory usage.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    },
    {
      "type": "function",
      "name": "math_calculator",
      "description": "Perform basic mathematical calculations. Supported operations include add, subtract, multiply, divide, and power.",
      "parameters": {
        "type": "object",
        "properties": {
          "a": {
            "description": "The first number.",
            "type": "number"
          },
          "b": {
            "description": "The second number.",
            "type": "number"
          },
          "operation": {
            "description": "The operation type. Supported values: add, subtract, multiply, divide, power.",
            "type": "string"
          }
        },
        "required": [
          "operation",
          "a",
          "b"
        ]
      }
    },
    {
      "type": "function",
      "name": "current_time",
      "description": "Get the current system time.",
      "parameters": {
        "type": "object",
        "properties": {}
      }
    }
  ]
}'

Response

🟢 200 OK

Response Body

Parameter NameTypeRequiredDescription
idstringRequired
objectstringRequired
createdintegerRequired
choicesarray[object]Required
  └ indexintegerOptional
  └ messageobjectOptional
  └ finish_reasonstringOptional
usageobjectRequired
  └ prompt_tokensintegerRequired
  └ completion_tokensintegerRequired
  └ total_tokensintegerRequired

Response Example

json
{
  "id": "resp_68ac1558e9488190bcc2cbb94c7d7a140b8064b15a091a77",
  "object": "response",
  "created_at": 1756108120,
  "status": "completed",
  "background": false,
  "content_filters": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-4.1-data",
  "output": [
    {
      "id": "fc_68ac15594be88190a58217f75a6a54cc0b8064b15a091a77",
      "type": "function_call",
      "status": "completed",
      "arguments": "{\"sign\":\"Aquarius\"}",
      "call_id": "call_6kbB2GTk62PPUNdGuBJPx9KQ",
      "name": "get_horoscope"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "store": true,
  "temperature": 1.0,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [
    {
      "type": "function",
      "description": "Get today's horoscope for an astrological sign.",
      "name": "get_horoscope",
      "parameters": {
        "properties": {
          "sign": {
            "description": "An astrological sign like Taurus or Aquarius",
            "type": "string"
          }
        },
        "required": [
          "sign"
        ],
        "type": "object"
      },
      "strict": true
    }
  ],
  "top_p": 1.0,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 62,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 18,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 80
  },
  "user": null,
  "metadata": {}
}