> 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 full documentation content, see https://developers.meshapi.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Create Response

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

Responses API endpoint — provider resolved dynamically from DB.

Auth:        Authorization: Bearer rsk_<ULID>
Streaming:   set stream=true for SSE chunks
Rate limits: RPM and RPD enforced per key via Redis fixed-window counters
Spend cap:   enforced if key.spend_cap_usd is set
Provider:    resolved from model_prices.provider (same as chat/completions)

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi
  version: 1.0.0
paths:
  /v1/responses:
    post:
      operationId: create-response-v-1-responses-post
      summary: Create Response
      description: >-
        Responses API endpoint — provider resolved dynamically from DB.


        Auth:        Authorization: Bearer rsk_<ULID>

        Streaming:   set stream=true for SSE chunks

        Rate limits: RPM and RPD enforced per key via Redis fixed-window
        counters

        Spend cap:   enforced if key.spend_cap_usd is set

        Provider:    resolved from model_prices.provider (same as
        chat/completions)
      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:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
servers:
  - url: https://api.meshapi.ai
components:
  schemas:
    ResponsesRequestInput:
      oneOf:
        - type: string
        - type: array
          items:
            description: Any type
      title: ResponsesRequestInput
    ResponsesFunctionTool:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
        name:
          type: string
        description:
          type:
            - string
            - 'null'
        parameters:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        strict:
          type:
            - boolean
            - 'null'
      required:
        - name
      description: >-
        Custom function tool in the Responses API flat format.


        The Responses API uses a flat structure (name/description/parameters at
        top

        level) unlike Chat Completions which nests them under a "function" key:

          Responses API:   {"type": "function", "name": "add", "parameters": {...}}
          Chat Completions: {"type": "function", "function": {"name": "add", ...}}
      title: ResponsesFunctionTool
    BuiltinToolType:
      type: string
      enum:
        - image_generation
        - web_search_preview
        - web_search_preview_2025_03_11
        - file_search
        - computer_use_preview
        - code_interpreter
      title: BuiltinToolType
    BuiltinTool:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/BuiltinToolType'
      required:
        - type
      description: >-
        Represents an OpenAI built-in tool (non-function), e.g. {"type":
        "image_generation"}.
      title: BuiltinTool
    ResponsesRequestToolsItems:
      oneOf:
        - $ref: '#/components/schemas/ResponsesFunctionTool'
        - $ref: '#/components/schemas/BuiltinTool'
      title: ResponsesRequestToolsItems
    ResponsesRequestToolChoice:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      title: ResponsesRequestToolChoice
    ResponsesRequest:
      type: object
      properties:
        model:
          type:
            - string
            - 'null'
        input:
          $ref: '#/components/schemas/ResponsesRequestInput'
        template:
          type:
            - string
            - 'null'
        variables:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
        session_id:
          type:
            - string
            - 'null'
        stream:
          type: boolean
          default: false
        max_output_tokens:
          type:
            - integer
            - 'null'
        temperature:
          type:
            - number
            - 'null'
          format: double
        top_p:
          type:
            - number
            - 'null'
          format: double
        seed:
          type:
            - integer
            - 'null'
        reasoning:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        tools:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ResponsesRequestToolsItems'
        tool_choice:
          oneOf:
            - $ref: '#/components/schemas/ResponsesRequestToolChoice'
            - type: 'null'
        response_format:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
        plugins:
          type:
            - array
            - 'null'
          items:
            description: Any type
        user:
          type:
            - string
            - 'null'
      required:
        - input
      title: ResponsesRequest
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python
import requests

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

payload = { "input": "What is the capital of France?" }
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":"What is the capital of France?"}'
};

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\": \"What is the capital of France?\"\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\": \"What is the capital of France?\"\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\": \"What is the capital of France?\"\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": "What is the capital of France?"
}',
  '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\": \"What is the capital of France?\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["input": "What is the capital of France?"] 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()
```