> For the complete documentation index, see [llms.txt](https://docs.fastrouter.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastrouter.ai/api-reference/responses.md).

# Responses

## Create Response

> Creates responses with conversation state management. Supports previous\_response\_id for context continuity, function calling, web search, and file inputs. Compatible with OpenAI, Azure, and X-AI (Grok) providers.

```json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Responses","description":"Alternative API for creating responses with built-in conversation state management."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, missing, or disabled. Check your credentials.\n\nNote: the 401 error body uses `code`, `message`, `param`, and `type` (there is no `status` field), and `type` is `invalid_request_error`.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"param":{"type":"string","nullable":true},"code":{"type":"string"}}}}}}}},"RateLimitError":{"description":"Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/api/v1/responses":{"post":{"operationId":"createResponse","tags":["Responses"],"summary":"Create Response","description":"Creates responses with conversation state management. Supports previous_response_id for context continuity, function calling, web search, and file inputs. Compatible with OpenAI, Azure, and X-AI (Grok) providers.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"Model ID in provider/model format. Examples: openai/o3, openai/gpt-4.1, x-ai/grok-4"},"input":{"oneOf":[{"type":"string","description":"Simple text input"},{"type":"array","description":"Array of message objects with role and content","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","system"],"description":"Role of the message"},"content":{"oneOf":[{"type":"string"},{"type":"array"}],"description":"Content as string or array of content blocks (text, files, etc.)"}}}}],"description":"User input - can be a simple string or array of message objects for multimodal/file inputs"},"previous_response_id":{"type":"string","description":"ID of a previous response to continue the conversation. Maintains context across requests."},"stream":{"type":"boolean","default":false,"description":"Enable streaming responses for real-time output"},"tools":{"type":"array","description":"Array of tool definitions. Supports custom functions and web_search tool.","items":{"type":"object","properties":{"type":{"type":"string","enum":["function","web_search"],"description":"Type of tool - 'function' for custom functions, 'web_search' for web search capability"},"name":{"type":"string","description":"Function name (for function tools)"},"description":{"type":"string","description":"Function description (for function tools)"},"parameters":{"type":"object","description":"Function parameters schema (for function tools)"},"filters":{"type":"object","description":"Filters for web search (for web_search tools)","properties":{"allowed_domains":{"type":"array","items":{"type":"string"},"description":"List of allowed domains for web search"}}}}}},"tool_choice":{"type":"string","enum":["auto","none"],"default":"auto","description":"Controls tool usage. 'auto' lets model decide, 'none' disables tools."},"temperature":{"type":"number","minimum":0,"maximum":2,"default":1,"description":"Sampling temperature for randomness control"},"max_tokens":{"type":"integer","description":"Maximum tokens to generate"},"background":{"type":"boolean","default":false,"description":"Run response generation in background"}}}}}},"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"Unique response ID (use for previous_response_id)"},"object":{"type":"string"},"created_at":{"type":"integer","description":"Unix timestamp"},"model":{"type":"string","description":"Model used"},"output":{"type":"array","description":"Array of output objects (reasoning, messages, etc.)","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["reasoning","message","function_call"]},"role":{"type":"string"},"status":{"type":"string"},"content":{"type":"array"}}}},"background":{"type":"boolean","description":"Whether request ran in background"},"error":{"type":"string","nullable":true,"description":"Error message if any"}}}}}},"400":{"description":"Bad Request - Invalid parameters"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"description":"Internal Server Error"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fastrouter.ai/api-reference/responses.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
