Skip to content
All documentation

API reference

Tool calling

Let a supported model request actions your application controls.

OPENAI BASE URLhttps://www.modelmesh.in/api/v1

Choose a capable model

Check the published tools capability. The gateway accepts tools and tool_choice; support depends on the upstream model. Not every catalog model can run a coding agent.

Your application executes tools

Supply a function name, description, and JSON input schema. Validate returned tool_calls arguments, execute authorized actions in your application, and return a tool message with the matching tool_call_id.

Keep the loop bounded

Set timeouts, output limits, and a maximum number of tool iterations. Treat generated arguments as untrusted input. ModelMesh routes model requests; it does not execute your functions or grant access to your files.

Request example

POSThttps://www.modelmesh.in/api/v1/chat/completions

Replace the key placeholder before running this example. This page does not send requests. Paid requests consume your allowance or funds.

$env:MODELMESH_API_KEY = 'YOUR_MODELMESH_KEY'

Invoke-RestMethod -Method Post -Uri 'https://www.modelmesh.in/api/v1/chat/completions' `
  -Headers @{Authorization="Bearer $env:MODELMESH_API_KEY"} `
  -ContentType 'application/json' `
  -Body '{
  "model": "YOUR_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "Say hello in one sentence."
    }
  ],
  "max_tokens": 64,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Read the weather for a city.",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string"
            }
          },
          "required": [
            "city"
          ]
        }
      }
    }
  ]
}'