> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/api-reference/mesh-api/responses/llms.txt.
> For full documentation content, see https://developers.meshapi.ai/api-reference/mesh-api/responses/llms-full.txt.

# Create a response

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

Responses API endpoint for dynamically resolved models.

This is used for models that support the Responses API structure.


Reference: https://developers.meshapi.ai/api-reference/mesh-api/responses/create-response

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi
  version: 1.0.0
paths:
  /v1/responses:
    post:
      operationId: create-response
      summary: Create a response
      description: |
        Responses API endpoint for dynamically resolved models.

        This is used for models that support the Responses API structure.
      tags:
        - subpackage_responses
      parameters:
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Responses_createResponse_Response_200'
        '401':
          description: Missing, malformed, or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: The request body failed validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
servers:
  - url: https://api.meshapi.ai
components:
  schemas:
    ResponsesRequestInputOneOf1Items:
      type: object
      properties: {}
      title: ResponsesRequestInputOneOf1Items
    ResponsesRequestInput1:
      type: array
      items:
        $ref: '#/components/schemas/ResponsesRequestInputOneOf1Items'
      title: ResponsesRequestInput1
    ResponsesRequestInput:
      oneOf:
        - type: string
        - $ref: '#/components/schemas/ResponsesRequestInput1'
      description: Input for the response.
      title: ResponsesRequestInput
    ResponsesRequestReasoning:
      type: object
      properties: {}
      description: Optional reasoning parameters.
      title: ResponsesRequestReasoning
    ToolFunctionParameters:
      type: object
      properties: {}
      title: ToolFunctionParameters
    ToolFunction:
      type: object
      properties:
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        parameters:
          oneOf:
            - $ref: '#/components/schemas/ToolFunctionParameters'
            - type: 'null'
      required:
        - name
      title: ToolFunction
    Tool:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/ToolFunction'
      required:
        - type
        - function
      title: Tool
    ResponsesRequestToolChoice0:
      type: string
      enum:
        - none
        - auto
        - required
      title: ResponsesRequestToolChoice0
    ToolChoiceFunction:
      type: object
      properties:
        name:
          type: string
      required:
        - name
      title: ToolChoiceFunction
    ToolChoice:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/ToolChoiceFunction'
      required:
        - type
        - function
      title: ToolChoice
    ResponsesRequestToolChoice:
      oneOf:
        - $ref: '#/components/schemas/ResponsesRequestToolChoice0'
        - $ref: '#/components/schemas/ToolChoice'
      description: Controls tool calling.
      title: ResponsesRequestToolChoice
    ResponsesRequestResponseFormat:
      type: object
      properties: {}
      description: Optional response format constraints (e.g. JSON schema).
      title: ResponsesRequestResponseFormat
    ResponsesRequestPluginsItems:
      type: object
      properties: {}
      title: ResponsesRequestPluginsItems
    ResponsesRequest:
      type: object
      properties:
        model:
          type:
            - string
            - 'null'
          default: qwen/qwen3-max
          description: Model identifier.
        input:
          $ref: '#/components/schemas/ResponsesRequestInput'
          description: Input for the response.
        template:
          type:
            - string
            - 'null'
          description: Template name or UUID to expand before inference.
        variables:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
          description: Values used when rendering `{{slot}}` placeholders.
        session_id:
          type:
            - string
            - 'null'
          description: Caller-defined grouping key for usage reporting.
        stream:
          type: boolean
          default: false
          description: When true, returns SSE chunks instead of a JSON object.
        max_output_tokens:
          type:
            - integer
            - 'null'
          description: Maximum number of output tokens to generate.
        temperature:
          type:
            - number
            - 'null'
          format: double
          description: Sampling temperature.
        top_p:
          type:
            - number
            - 'null'
          format: double
          description: Nucleus sampling threshold.
        seed:
          type:
            - integer
            - 'null'
          description: Optional seed for best-effort determinism.
        reasoning:
          oneOf:
            - $ref: '#/components/schemas/ResponsesRequestReasoning'
            - type: 'null'
          description: Optional reasoning parameters.
        tools:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Tool'
          description: Tool definitions.
        tool_choice:
          oneOf:
            - $ref: '#/components/schemas/ResponsesRequestToolChoice'
            - type: 'null'
          description: Controls tool calling.
        response_format:
          oneOf:
            - $ref: '#/components/schemas/ResponsesRequestResponseFormat'
            - type: 'null'
          description: Optional response format constraints (e.g. JSON schema).
        plugins:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ResponsesRequestPluginsItems'
          description: Optional plugins to use.
        user:
          type:
            - string
            - 'null'
          description: End-user identifier for abuse monitoring.
      required:
        - input
      title: ResponsesRequest
    Responses_createResponse_Response_200:
      type: object
      properties: {}
      title: Responses_createResponse_Response_200
    ErrorBodyCode:
      type: string
      enum:
        - unauthorized
        - forbidden
        - not_found
        - model_not_found
        - validation_error
        - unprocessable_entity
        - rate_limit_exceeded
        - spend_limit_exceeded
        - conflict
        - upstream_error
        - provider_not_available
        - gateway_timeout
      title: ErrorBodyCode
    ValidationErrorDetailLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorDetailLocItems
    ValidationErrorDetail:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorDetailLocItems'
        msg:
          type: string
        type:
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationErrorDetail
    ProviderError:
      type: object
      properties:
        provider:
          type: string
        status:
          type:
            - integer
            - 'null'
        message:
          type:
            - string
            - 'null'
      title: ProviderError
    ErrorBody:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ErrorBodyCode'
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        details:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ValidationErrorDetail'
        provider_error:
          oneOf:
            - $ref: '#/components/schemas/ProviderError'
            - type: 'null'
        retry_after_seconds:
          type:
            - integer
            - 'null'
      required:
        - code
        - message
      title: ErrorBody
    ErrorEnvelope:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
        request_id:
          type: string
      required:
        - error
        - request_id
      title: ErrorEnvelope
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python
import requests

url = "https://api.meshapi.ai/v1/responses"

payload = {
    "input": "Write a short story about a time-traveling toaster.",
    "model": "qwen/qwen3-max"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.meshapi.ai/v1/responses';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"input":"Write a short story about a time-traveling toaster.","model":"qwen/qwen3-max"}'
};

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

```go
package main

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

func main() {

	url := "https://api.meshapi.ai/v1/responses"

	payload := strings.NewReader("{\n  \"input\": \"Write a short story about a time-traveling toaster.\",\n  \"model\": \"qwen/qwen3-max\"\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
require 'uri'
require 'net/http'

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

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  \"input\": \"Write a short story about a time-traveling toaster.\",\n  \"model\": \"qwen/qwen3-max\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.meshapi.ai/v1/responses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"input\": \"Write a short story about a time-traveling toaster.\",\n  \"model\": \"qwen/qwen3-max\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.meshapi.ai/v1/responses', [
  'body' => '{
  "input": "Write a short story about a time-traveling toaster.",
  "model": "qwen/qwen3-max"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.meshapi.ai/v1/responses");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"input\": \"Write a short story about a time-traveling toaster.\",\n  \"model\": \"qwen/qwen3-max\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "input": "Write a short story about a time-traveling toaster.",
  "model": "qwen/qwen3-max"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meshapi.ai/v1/responses")! 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()
```