Skip to main content

Minimal request

{
  "model": "gpt-4.1",
  "input": "Get today's Shanghai weather.",
  "tools": [
    {
      "type": "function",
      "name": "get_weather",
      "description": "Fetch weather",
      "parameters": {
        "type": "object",
        "properties": {
          "city": { "type": "string" }
        },
        "required": ["city"]
      }
    }
  ]
}

cURL example

curl https://mass.apigo.ai/v1/responses \
  -H "Authorization: Bearer $TIDEMIND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1",
    "input": "Get today's Shanghai weather.",
    "tools": [
      {
        "type": "function",
        "name": "get_weather",
        "description": "Fetch weather",
        "parameters": {
          "type": "object",
          "properties": {
            "city": { "type": "string" }
          },
          "required": ["city"]
        }
      }
    ]
  }'

Python example

from openai import OpenAI

client = OpenAI(
    base_url="https://mass.apigo.ai/v1",
    api_key="<TIDEMIND_API_KEY>",
)

response = client.responses.create(
    model="gpt-4.1",
    input="Get today's Shanghai weather.",
    tools=[
        {
            "type": "function",
            "name": "get_weather",
            "description": "Fetch weather",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {"type": "string"},
                },
                "required": ["city"],
            },
        }
    ],
)

print(response.output)

Node.js example

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://mass.apigo.ai/v1",
  apiKey: process.env.TIDEMIND_API_KEY,
});

const response = await client.responses.create({
  model: "gpt-4.1",
  input: "Get today's Shanghai weather.",
  tools: [
    {
      type: "function",
      name: "get_weather",
      description: "Fetch weather",
      parameters: {
        type: "object",
        properties: {
          city: { type: "string" }
        },
        required: ["city"]
      }
    }
  ]
});

console.log(response.output);

Best practices

  • Keep function schemas explicit and strict
  • Do not assume there will be only one tool call
  • Persist the raw tool calls and tool results for replay and debugging