> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Chat Compare

POST https://api.meshapi.ai/v1/chat/compare
Content-Type: application/json

Reference: https://developers.meshapi.ai/api-reference/mesh-api/chat/compare

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi
  version: 1.0.0
paths:
  /v1/chat/compare:
    post:
      operationId: compare
      summary: Chat Compare
      tags:
        - chat
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: >-
            Per-model results plus an optional synthesized comparison (JSON), or
            an SSE stream when stream=true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CompareResponse'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '402':
          description: Insufficient balance or spend cap reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: API key is suspended
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Request validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Rate limit exceeded (RPM or RPD)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Upstream provider error or gateway timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '502':
          description: Upstream provider error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '503':
          description: >-
            Upstream provider not available — required credentials not
            configured on this server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CompareRequest'
servers:
  - url: https://api.meshapi.ai
    description: Production Server
components:
  schemas:
    MessageRole:
      type: string
      enum:
        - system
        - user
        - assistant
        - tool
      title: MessageRole
    ContentPartType:
      type: string
      enum:
        - text
        - image_url
        - video_url
        - input_audio
      title: ContentPartType
    ImageUrlDetail:
      type: string
      enum:
        - auto
        - low
        - high
      default: auto
      title: ImageUrlDetail
    ImageUrl:
      type: object
      properties:
        url:
          type: string
        detail:
          $ref: '#/components/schemas/ImageUrlDetail'
      required:
        - url
      title: ImageUrl
    VideoUrl:
      type: object
      properties:
        url:
          type: string
      required:
        - url
      title: VideoUrl
    InputAudioFormat:
      type: string
      enum:
        - wav
        - mp3
        - aiff
        - aac
        - ogg
        - flac
        - m4a
        - pcm16
        - pcm24
      title: InputAudioFormat
    InputAudio:
      type: object
      properties:
        data:
          type:
            - string
            - 'null'
        uri:
          type:
            - string
            - 'null'
        url:
          type:
            - string
            - 'null'
        format:
          $ref: '#/components/schemas/InputAudioFormat'
      required:
        - format
      title: InputAudio
    ContentPart:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ContentPartType'
        text:
          type:
            - string
            - 'null'
        image_url:
          oneOf:
            - $ref: '#/components/schemas/ImageUrl'
            - type: 'null'
        video_url:
          oneOf:
            - $ref: '#/components/schemas/VideoUrl'
            - type: 'null'
        input_audio:
          oneOf:
            - $ref: '#/components/schemas/InputAudio'
            - type: 'null'
        fps:
          type:
            - string
            - 'null'
        cache_control:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
      required:
        - type
      title: ContentPart
    MessageContent1:
      type: array
      items:
        $ref: '#/components/schemas/ContentPart'
      title: MessageContent1
    MessageContent:
      oneOf:
        - type: string
        - $ref: '#/components/schemas/MessageContent1'
      title: MessageContent
    ToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          type: object
          additionalProperties:
            description: Any type
        thought_signature:
          type:
            - string
            - 'null'
      required:
        - id
        - function
      title: ToolCall
    Message:
      type: object
      properties:
        role:
          $ref: '#/components/schemas/MessageRole'
        content:
          oneOf:
            - $ref: '#/components/schemas/MessageContent'
            - type: 'null'
        name:
          type:
            - string
            - 'null'
        tool_call_id:
          type:
            - string
            - 'null'
        tool_calls:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ToolCall'
        reasoning_details:
          type:
            - array
            - 'null'
          items:
            type: object
            additionalProperties:
              description: Any type
        cache_control:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
      required:
        - role
      title: Message
    ModelOverride:
      type: object
      properties:
        model:
          type: string
        temperature:
          type:
            - number
            - 'null'
          format: double
        max_tokens:
          type:
            - integer
            - 'null'
        system_prompt:
          type:
            - string
            - 'null'
      required:
        - model
      description: >-
        Per-model parameter overrides applied on top of the request-level
        defaults.
      title: ModelOverride
    CompareRequest:
      type: object
      properties:
        models:
          type: array
          items:
            type: string
        messages:
          type: array
          items:
            $ref: '#/components/schemas/Message'
        model_overrides:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ModelOverride'
        comparison_model:
          type:
            - string
            - 'null'
        comparison_instructions:
          type:
            - string
            - 'null'
        temperature:
          type:
            - number
            - 'null'
          format: double
        max_tokens:
          type:
            - integer
            - 'null'
        stream:
          type: boolean
          default: false
        template:
          type:
            - string
            - 'null'
        variables:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
        skip_comparison:
          type: boolean
          default: false
        cache:
          type:
            - boolean
            - 'null'
      required:
        - models
        - messages
      title: CompareRequest
    TokenUsage:
      type: object
      properties:
        prompt_tokens:
          type:
            - integer
            - 'null'
        completion_tokens:
          type:
            - integer
            - 'null'
        total_tokens:
          type:
            - integer
            - 'null'
      title: TokenUsage
    ModelCompareResult:
      type: object
      properties:
        model:
          type: string
          description: Model ID this result is for.
        response_body:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
          description: >-
            Full upstream chat-completion response (raw provider body, including
            `choices` and `usage`). Null when the call failed.
        content:
          type:
            - string
            - 'null'
          description: >-
            Assistant message text extracted from `response_body`. Null on
            error.
        latency_ms:
          type: integer
          description: Wall-clock latency for this model's call, in milliseconds.
        error:
          type:
            - string
            - 'null'
          description: Human-readable error message when the call failed, else null.
        error_code:
          type:
            - string
            - 'null'
          description: Machine-readable error code when the call failed, else null.
        usage:
          oneOf:
            - $ref: '#/components/schemas/TokenUsage'
            - type: 'null'
          description: Token usage for this model's call.
        request_id:
          type: string
          description: Per-model sub-request ID (`<request_id>::<model>`).
      required:
        - model
        - latency_ms
        - request_id
      description: Outcome of a single fan-out model call.
      title: ModelCompareResult
    CompareResponse:
      type: object
      properties:
        comparison_id:
          type: string
          description: Unique ID for this comparison (`cmp_...`).
        object:
          type: string
          enum:
            - compare.completion
        created:
          type: integer
          description: Unix timestamp (seconds) when the response was produced.
        models:
          type: array
          items:
            type: string
          description: Models that were compared, in request order (deduped).
        results:
          type: array
          items:
            $ref: '#/components/schemas/ModelCompareResult'
          description: Per-model results, in `models` order.
        comparison:
          type:
            - string
            - 'null'
          description: >-
            Synthesized evaluation of all responses from the comparison LLM.
            Null when `skip_comparison` is true or fewer than two models
            succeeded.
        comparison_model:
          type:
            - string
            - 'null'
          description: Model that produced `comparison`. Null when no synthesis ran.
        comparison_usage:
          oneOf:
            - $ref: '#/components/schemas/TokenUsage'
            - type: 'null'
          description: Token usage for the comparison LLM call.
        comparison_fallback_used:
          type: boolean
          default: false
          description: >-
            True if the primary comparison model failed and a fallback produced
            the synthesis.
        total_latency_ms:
          type: integer
          description: End-to-end latency for the whole compare request, in milliseconds.
        partial:
          type: boolean
          default: false
          description: True if at least one model in `results` returned an error.
        skip_comparison:
          type: boolean
          default: false
          description: Echoes whether the comparison LLM step was skipped.
      required:
        - comparison_id
        - created
        - models
        - results
        - total_latency_ms
      title: CompareResponse
    ProviderError:
      type: object
      properties:
        provider:
          type: string
        status:
          type:
            - integer
            - 'null'
        message:
          type:
            - string
            - 'null'
      required:
        - provider
      description: Upstream provider error forwarded for debugging.
      title: ProviderError
    ErrorDetail:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        details:
          type:
            - array
            - 'null'
          items:
            description: Any type
        provider_error:
          oneOf:
            - $ref: '#/components/schemas/ProviderError'
            - type: 'null'
        retry_after_seconds:
          type:
            - integer
            - 'null'
      required:
        - code
        - message
      title: ErrorDetail
    ErrorEnvelope:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
        request_id:
          type: string
          default: ''
      required:
        - error
      title: ErrorEnvelope
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## Examples

### Chat_compare_example



**Request**

```json
undefined
```

**Response**

```json
{
  "comparison_id": "cmp_01ARZ3NDEKTSV4RRFFQ6",
  "created": 1748331628,
  "models": [
    "openai/gpt-4o-mini",
    "anthropic/claude-haiku-4.5",
    "google/gemini-3-flash-preview"
  ],
  "results": [
    {
      "model": "openai/gpt-4o-mini",
      "latency_ms": 812,
      "request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV::openai/gpt-4o-mini",
      "response_body": {
        "id": "chatcmpl-DrTNOwFsT3v79HmQwOwMgEM2IbWJl",
        "object": "chat.completion",
        "created": 1748331628,
        "model": "gpt-4o-mini-2024-07-18",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "TCP is a connection-oriented protocol that guarantees ordered, reliable delivery; UDP is connectionless and sends datagrams without delivery or ordering guarantees."
            },
            "finish_reason": "stop"
          }
        ],
        "usage": {
          "prompt_tokens": 24,
          "completion_tokens": 47,
          "total_tokens": 71
        }
      },
      "content": "TCP is a connection-oriented protocol that guarantees ordered, reliable delivery; UDP is connectionless and sends datagrams without delivery or ordering guarantees.",
      "usage": {
        "prompt_tokens": 24,
        "completion_tokens": 47,
        "total_tokens": 71
      }
    },
    {
      "model": "anthropic/claude-haiku-4.5",
      "latency_ms": 650,
      "request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV::anthropic/claude-haiku-4.5",
      "response_body": {
        "id": "chatcmpl-019ed1d24b0371a390ab",
        "object": "chat.completion",
        "model": "anthropic/claude-haiku-4.5",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "TCP establishes a connection and guarantees ordered, intact delivery. UDP fires packets without a connection, trading reliability for lower latency."
            },
            "finish_reason": "stop"
          }
        ],
        "usage": {
          "prompt_tokens": 24,
          "completion_tokens": 52,
          "total_tokens": 76
        }
      },
      "content": "TCP establishes a connection and guarantees ordered, intact delivery. UDP fires packets without a connection, trading reliability for lower latency.",
      "usage": {
        "prompt_tokens": 24,
        "completion_tokens": 52,
        "total_tokens": 76
      }
    },
    {
      "model": "google/gemini-3-flash-preview",
      "latency_ms": 0,
      "request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV::google/gemini-3-flash-preview",
      "error": "Upstream provider returned an error.",
      "error_code": "upstream_error"
    }
  ],
  "total_latency_ms": 1340,
  "object": "compare.completion",
  "comparison": "Both answers are correct. Claude's phrasing is slightly clearer on the latency trade-off; GPT-4o-mini is more precise on ordering guarantees.",
  "comparison_model": "openai/gpt-4o-mini",
  "comparison_usage": {
    "prompt_tokens": 180,
    "completion_tokens": 60,
    "total_tokens": 240
  },
  "comparison_fallback_used": false,
  "partial": true,
  "skip_comparison": false
}
```

**SDK Code**

```python Chat_compare_example
import requests

url = "https://api.meshapi.ai/v1/chat/compare"

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Chat_compare_example
const url = 'https://api.meshapi.ai/v1/chat/compare';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: undefined
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Chat_compare_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meshapi.ai/v1/chat/compare"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Chat_compare_example
require 'uri'
require 'net/http'

url = URI("https://api.meshapi.ai/v1/chat/compare")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'

response = http.request(request)
puts response.read_body
```

```java Chat_compare_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/chat/compare")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Chat_compare_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.meshapi.ai/v1/chat/compare', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Chat_compare_example
using RestSharp;

var client = new RestClient("https://api.meshapi.ai/v1/chat/compare");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Chat_compare_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meshapi.ai/v1/chat/compare")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Example request



**Request**

```json
{
  "models": [
    "openai/gpt-4o-mini",
    "anthropic/claude-haiku-4.5"
  ],
  "messages": [
    {
      "role": "user",
      "content": "Explain TCP vs UDP in two sentences."
    }
  ],
  "comparison_model": "openai/gpt-4o-mini"
}
```

**Response**

```json
{
  "comparison_id": "cmp_01ARZ3NDEKTSV4RRFFQ6",
  "created": 1748331628,
  "models": [
    "openai/gpt-4o-mini",
    "anthropic/claude-haiku-4.5",
    "google/gemini-3-flash-preview"
  ],
  "results": [
    {
      "model": "openai/gpt-4o-mini",
      "latency_ms": 812,
      "request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV::openai/gpt-4o-mini",
      "response_body": {
        "id": "chatcmpl-DrTNOwFsT3v79HmQwOwMgEM2IbWJl",
        "object": "chat.completion",
        "created": 1748331628,
        "model": "gpt-4o-mini-2024-07-18",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "TCP is a connection-oriented protocol that guarantees ordered, reliable delivery; UDP is connectionless and sends datagrams without delivery or ordering guarantees."
            },
            "finish_reason": "stop"
          }
        ],
        "usage": {
          "prompt_tokens": 24,
          "completion_tokens": 47,
          "total_tokens": 71
        }
      },
      "content": "TCP is a connection-oriented protocol that guarantees ordered, reliable delivery; UDP is connectionless and sends datagrams without delivery or ordering guarantees.",
      "usage": {
        "prompt_tokens": 24,
        "completion_tokens": 47,
        "total_tokens": 71
      }
    },
    {
      "model": "anthropic/claude-haiku-4.5",
      "latency_ms": 650,
      "request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV::anthropic/claude-haiku-4.5",
      "response_body": {
        "id": "chatcmpl-019ed1d24b0371a390ab",
        "object": "chat.completion",
        "model": "anthropic/claude-haiku-4.5",
        "choices": [
          {
            "index": 0,
            "message": {
              "role": "assistant",
              "content": "TCP establishes a connection and guarantees ordered, intact delivery. UDP fires packets without a connection, trading reliability for lower latency."
            },
            "finish_reason": "stop"
          }
        ],
        "usage": {
          "prompt_tokens": 24,
          "completion_tokens": 52,
          "total_tokens": 76
        }
      },
      "content": "TCP establishes a connection and guarantees ordered, intact delivery. UDP fires packets without a connection, trading reliability for lower latency.",
      "usage": {
        "prompt_tokens": 24,
        "completion_tokens": 52,
        "total_tokens": 76
      }
    },
    {
      "model": "google/gemini-3-flash-preview",
      "latency_ms": 0,
      "request_id": "req_01ARZ3NDEKTSV4RRFFQ69G5FAV::google/gemini-3-flash-preview",
      "error": "Upstream provider returned an error.",
      "error_code": "upstream_error"
    }
  ],
  "total_latency_ms": 1340,
  "object": "compare.completion",
  "comparison": "Both answers are correct. Claude's phrasing is slightly clearer on the latency trade-off; GPT-4o-mini is more precise on ordering guarantees.",
  "comparison_model": "openai/gpt-4o-mini",
  "comparison_usage": {
    "prompt_tokens": 180,
    "completion_tokens": 60,
    "total_tokens": 240
  },
  "comparison_fallback_used": false,
  "partial": true,
  "skip_comparison": false
}
```

**SDK Code**

```python Example request
import requests

url = "https://api.meshapi.ai/v1/chat/compare"

payload = {
    "models": ["openai/gpt-4o-mini", "anthropic/claude-haiku-4.5"],
    "messages": [
        {
            "role": "user",
            "content": "Explain TCP vs UDP in two sentences."
        }
    ],
    "comparison_model": "openai/gpt-4o-mini"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Example request
const url = 'https://api.meshapi.ai/v1/chat/compare';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"models":["openai/gpt-4o-mini","anthropic/claude-haiku-4.5"],"messages":[{"role":"user","content":"Explain TCP vs UDP in two sentences."}],"comparison_model":"openai/gpt-4o-mini"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Example request
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meshapi.ai/v1/chat/compare"

	payload := strings.NewReader("{\n  \"models\": [\n    \"openai/gpt-4o-mini\",\n    \"anthropic/claude-haiku-4.5\"\n  ],\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Explain TCP vs UDP in two sentences.\"\n    }\n  ],\n  \"comparison_model\": \"openai/gpt-4o-mini\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Example request
require 'uri'
require 'net/http'

url = URI("https://api.meshapi.ai/v1/chat/compare")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"models\": [\n    \"openai/gpt-4o-mini\",\n    \"anthropic/claude-haiku-4.5\"\n  ],\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Explain TCP vs UDP in two sentences.\"\n    }\n  ],\n  \"comparison_model\": \"openai/gpt-4o-mini\"\n}"

response = http.request(request)
puts response.read_body
```

```java Example request
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/chat/compare")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"models\": [\n    \"openai/gpt-4o-mini\",\n    \"anthropic/claude-haiku-4.5\"\n  ],\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Explain TCP vs UDP in two sentences.\"\n    }\n  ],\n  \"comparison_model\": \"openai/gpt-4o-mini\"\n}")
  .asString();
```

```php Example request
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.meshapi.ai/v1/chat/compare', [
  'body' => '{
  "models": [
    "openai/gpt-4o-mini",
    "anthropic/claude-haiku-4.5"
  ],
  "messages": [
    {
      "role": "user",
      "content": "Explain TCP vs UDP in two sentences."
    }
  ],
  "comparison_model": "openai/gpt-4o-mini"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Example request
using RestSharp;

var client = new RestClient("https://api.meshapi.ai/v1/chat/compare");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"models\": [\n    \"openai/gpt-4o-mini\",\n    \"anthropic/claude-haiku-4.5\"\n  ],\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Explain TCP vs UDP in two sentences.\"\n    }\n  ],\n  \"comparison_model\": \"openai/gpt-4o-mini\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Example request
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "models": ["openai/gpt-4o-mini", "anthropic/claude-haiku-4.5"],
  "messages": [
    [
      "role": "user",
      "content": "Explain TCP vs UDP in two sentences."
    ]
  ],
  "comparison_model": "openai/gpt-4o-mini"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meshapi.ai/v1/chat/compare")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```