For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://modelgates.ai/docs/_mcp/server.

Body Builder

The Body Builder (modelgates/bodybuilder) transforms natural language prompts into structured ModelGates API requests, enabling you to easily run the same task across multiple models in parallel.

Overview

Body Builder uses AI to understand your intent and generate valid ModelGates API request bodies. Simply describe what you want to accomplish and which models you want to use, and Body Builder returns ready-to-execute JSON requests.

Body Builder is free to use. There is no charge for generating the request bodies.

Usage

typescript
import { ModelGates } from '@modelgates/sdk'; const modelgates = new ModelGates({  apiKey: '<MODELGATES_API_KEY>',}); const completion = await modelgates.chat.send({  model: 'modelgates/bodybuilder',  messages: [    {      role: 'user',      content: 'Count to 10 using Claude Sonnet and GPT-5',    },  ],}); // Parse the generated requestsconst generatedRequests = JSON.parse(completion.choices[0].message.content);console.log(generatedRequests);
typescript
const response = await fetch('https://modelgates.ai/api/v1/chat/completions', {  method: 'POST',  headers: {    'Authorization': 'Bearer <MODELGATES_API_KEY>',    'Content-Type': 'application/json',  },  body: JSON.stringify({    model: 'modelgates/bodybuilder',    messages: [      {        role: 'user',        content: 'Count to 10 using Claude Sonnet and GPT-5',      },    ],  }),}); const data = await response.json();const generatedRequests = JSON.parse(data.choices[0].message.content);console.log(generatedRequests);
python
import requestsimport json response = requests.post(  url="https://modelgates.ai/api/v1/chat/completions",  headers={    "Authorization": "Bearer <MODELGATES_API_KEY>",    "Content-Type": "application/json",  },  data=json.dumps({    "model": "modelgates/bodybuilder",    "messages": [      {        "role": "user",        "content": "Count to 10 using Claude Sonnet and GPT-5"      }    ]  })) data = response.json()generated_requests = json.loads(data['choices'][0]['message']['content'])print(json.dumps(generated_requests, indent=2))

Response Format

Body Builder returns a JSON object containing an array of ModelGates-compatible request bodies:

json
{  "requests": [    {      "model": "anthropic/claude-sonnet-4.5",      "messages": [        {"role": "user", "content": "Count to 10"}      ]    },    {      "model": "openai/gpt-5.1",      "messages": [        {"role": "user", "content": "Count to 10"}      ]    }  ]}

Executing Generated Requests

After generating the request bodies, execute them in parallel:

typescript
// Generate the requestsconst builderResponse = await modelgates.chat.send({  model: 'modelgates/bodybuilder',  messages: [{ role: 'user', content: 'Explain gravity using Gemini and Claude' }],}); const { requests } = JSON.parse(builderResponse.choices[0].message.content); // Execute all requests in parallelconst results = await Promise.all(  requests.map((req) => modelgates.chat.send(req))); // Process resultsresults.forEach((result, i) => {  console.log(`Model: $`);  console.log(`Response: $\n`);});
python
import asyncioimport aiohttpimport json async def execute_request(session, request):    async with session.post(        "https://modelgates.ai/api/v1/chat/completions",        headers={            "Authorization": "Bearer <MODELGATES_API_KEY>",            "Content-Type": "application/json"        },        data=json.dumps(request)    ) as response:        return await response.json() async def main():    # First, generate the requests    async with aiohttp.ClientSession() as session:        builder_response = await execute_request(session, {            "model": "modelgates/bodybuilder",            "messages": [{"role": "user", "content": "Explain gravity using Gemini and Claude"}]        })         generated = json.loads(builder_response['choices'][0]['message']['content'])         # Execute all requests in parallel        tasks = [execute_request(session, req) for req in generated['requests']]        results = await asyncio.gather(*tasks)         for req, result in zip(generated['requests'], results):            print(f"Model: {req['model']}")            print(f"Response: {result['choices'][0]['message']['content']}\n") asyncio.run(main())

Use Cases

Model Benchmarking

Compare how different models handle the same task:

code
"Write a haiku about programming using Claude Sonnet, GPT-5, and Gemini"

Redundancy and Reliability

Get responses from multiple providers for critical applications:

code
"Answer 'What is 2+2?' using three different models for verification"

A/B Testing

Test prompts across models to find the best fit:

code
"Summarize this article using the top 5 coding models: [article text]"

Exploration

Discover which models excel at specific tasks:

code
"Generate a creative story opening using various creative writing models"

Model Selection

Body Builder has access to all available ModelGates models and will:

  • Use the latest model versions by default
  • Select appropriate models based on your description
  • Understand model aliases and common names

Model slugs change as new versions are released. The examples below are current as of December 4, 2025. Check the models page for the latest available models.

Example model references that work:

  • "Claude Sonnet" → anthropic/claude-sonnet-4.5
  • "Claude Opus" → anthropic/claude-opus-4.5
  • "GPT-5" → openai/gpt-5.1
  • "Gemini" → google/gemini-3.1-pro-preview
  • "DeepSeek" → deepseek/deepseek-v3.2

Pricing

  • Body Builder requests: Free (no charge for generating request bodies)
  • Executing generated requests: Standard model pricing applies

Limitations

  • Requires messages format input
  • Generated requests use minimal required fields by default
  • System messages in your input are preserved and forwarded