POST
/
v1
/
responses
curl -X POST https://www.anyfast.ai/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1",
    "input": [
      {
        "role": "user",
        "content": "Get the current system time and calculate 123.5 + 456.7"
      }
    ],
    "tool_choice": "auto",
    "tools": [
      {
        "type": "function",
        "name": "get_time",
        "description": "Get the current system time",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      },
      {
        "type": "function",
        "name": "calculate",
        "description": "Calculate a math expression",
        "parameters": {
          "type": "object",
          "properties": {
            "expression": {
              "type": "string",
              "description": "The math expression to calculate"
            }
          },
          "required": ["expression"]
        }
      }
    ]
  }'
{
  "id": "resp_68ac1558e9488190bcc2cbb94c7d7a140b8064b15a091a77",
  "object": "response",
  "created_at": 1756108120,
  "status": "completed",
  "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,
  "usage": {
    "input_tokens": 62,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 18,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 80
  }
}
Use the Responses API to perform function calling (tool use) with supported models.

Request Parameters

model
string
required
The model ID to use. Example: gpt-4.1
input
array
required
Array of input messages.
tools
array
required
Array of tools the model may call. Each tool has:
  • type (string): Tool type, e.g. "function"
  • name (string): Function name
  • description (string): Function description
  • parameters (object): JSON Schema for function parameters
tool_choice
string
default:"auto"
Controls which tool the model calls. Options: auto, none, required
curl -X POST https://www.anyfast.ai/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1",
    "input": [
      {
        "role": "user",
        "content": "Get the current system time and calculate 123.5 + 456.7"
      }
    ],
    "tool_choice": "auto",
    "tools": [
      {
        "type": "function",
        "name": "get_time",
        "description": "Get the current system time",
        "parameters": {
          "type": "object",
          "properties": {}
        }
      },
      {
        "type": "function",
        "name": "calculate",
        "description": "Calculate a math expression",
        "parameters": {
          "type": "object",
          "properties": {
            "expression": {
              "type": "string",
              "description": "The math expression to calculate"
            }
          },
          "required": ["expression"]
        }
      }
    ]
  }'
{
  "id": "resp_68ac1558e9488190bcc2cbb94c7d7a140b8064b15a091a77",
  "object": "response",
  "created_at": 1756108120,
  "status": "completed",
  "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,
  "usage": {
    "input_tokens": 62,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 18,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 80
  }
}