{
  "description": "Anthropic tool_use compatible definitions for TheRouter.ai API. These can be passed directly to the 'tools' parameter of Claude's Messages API.",
  "base_url": "https://api.therouter.ai",
  "tools": [
    {
      "name": "create_chat_completion",
      "description": "Send a chat completion request through TheRouter gateway. Supports 200+ models across OpenAI, Anthropic, Google, Meta, and more. POST /v1/chat/completions. Returns a ChatCompletion object with model response, usage stats, and finish reason.",
      "input_schema": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Model alias in provider/model format. Examples: 'openai/gpt-4o', 'openai/gpt-4o-mini', 'google/gemini-2.0-flash'. Required unless 'models' array is provided."
          },
          "messages": {
            "type": "array",
            "description": "Conversation history. Each message has 'role' (system|user|assistant|tool) and 'content' (string or content parts).",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "enum": ["system", "user", "assistant", "tool"],
                  "description": "Message author role."
                },
                "content": {
                  "type": "string",
                  "description": "Message text content."
                },
                "tool_call_id": {
                  "type": "string",
                  "description": "Required for role=tool. ID of the tool call being responded to."
                }
              },
              "required": ["role"]
            }
          },
          "temperature": {
            "type": "number",
            "description": "Sampling temperature (0–2). Default varies by model."
          },
          "max_tokens": {
            "type": "integer",
            "description": "Maximum tokens to generate."
          },
          "stream": {
            "type": "boolean",
            "description": "If true, returns server-sent events. Default: false."
          },
          "tools": {
            "type": "array",
            "description": "Nested tool/function definitions the model may call.",
            "items": {
              "type": "object",
              "properties": {
                "type": { "type": "string", "enum": ["function"] },
                "function": {
                  "type": "object",
                  "properties": {
                    "name": { "type": "string" },
                    "description": { "type": "string" },
                    "parameters": { "type": "object" }
                  },
                  "required": ["name", "parameters"]
                }
              }
            }
          },
          "response_format": {
            "type": "object",
            "description": "Set to {\"type\":\"json_object\"} for JSON mode."
          },
          "models": {
            "type": "array",
            "items": { "type": "string" },
            "description": "TheRouter extension: fallback model chain."
          },
          "provider": {
            "type": "object",
            "description": "TheRouter extension: provider routing preferences.",
            "properties": {
              "allow_fallbacks": { "type": "boolean" },
              "order": { "type": "array", "items": { "type": "string" } },
              "only": { "type": "array", "items": { "type": "string" } },
              "ignore": { "type": "array", "items": { "type": "string" } }
            }
          },
          "route": {
            "type": "string",
            "enum": ["fallback", "sort"],
            "description": "TheRouter extension: routing strategy."
          }
        },
        "required": ["messages"]
      }
    },
    {
      "name": "list_models",
      "description": "List all available models on TheRouter gateway. Returns model IDs, pricing per token, context lengths, supported parameters, and architecture metadata. GET /v1/models.",
      "input_schema": {
        "type": "object",
        "properties": {},
        "required": []
      }
    },
    {
      "name": "get_credits",
      "description": "Check credit balance and total usage on TheRouter. Requires management API key (sk-mgmt-... prefix). GET /api/v1/credits. Returns {data: {total_credits: number, total_usage: number}}.",
      "input_schema": {
        "type": "object",
        "properties": {},
        "required": []
      }
    },
    {
      "name": "create_embedding",
      "description": "Create vector embeddings for input text via TheRouter gateway. POST /v1/embeddings. Returns embedding vectors.",
      "input_schema": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "Embedding model ID, e.g. 'openai/text-embedding-3-small'."
          },
          "input": {
            "type": "string",
            "description": "Text to embed. Can also be an array of strings for batch embedding."
          },
          "encoding_format": {
            "type": "string",
            "enum": ["float", "base64"],
            "description": "Output encoding format. Default: 'float'."
          }
        },
        "required": ["model", "input"]
      }
    }
  ]
}
