# RLM

Recursive Language Model endpoints.

## Create an RLM response

> OpenAI Responses-style endpoint for Recursive Language Model execution. Accepts a strict subset of the Responses request shape and proxies to the internal RLM backend.

```json
{"openapi":"3.1.0","info":{"title":"Maniac Inference Gateway API","version":"1.0.0"},"tags":[{"name":"RLM","description":"Recursive Language Model endpoints."}],"servers":[{"url":"https://platform.maniac.ai","description":"The Maniac API"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"API key in Authorization header using Bearer <token>."}},"schemas":{"RLMResponsesResponse":{"properties":{"id":{"type":"string","title":"Id"},"object":{"type":"string","const":"response","title":"Object","default":"response"},"created_at":{"type":"integer","title":"Created At"},"status":{"type":"string","enum":["in_progress","completed","failed"],"title":"Status"},"model":{"type":"string","title":"Model"},"store":{"type":"boolean","const":false,"title":"Store","default":false},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"},"output":{"anyOf":[{"items":{"$ref":"#/components/schemas/RLMResponsesOutputMessage"},"type":"array"},{"type":"null"}],"title":"Output"},"output_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Text"},"usage":{"anyOf":[{"$ref":"#/components/schemas/RLMResponsesUsage"},{"type":"null"}]},"error":{"anyOf":[{"$ref":"#/components/schemas/RLMResponsesError"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["id","created_at","status","model"],"title":"RLMResponsesResponse"},"RLMResponsesOutputMessage":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","const":"message","title":"Type","default":"message"},"status":{"type":"string","const":"completed","title":"Status","default":"completed"},"role":{"type":"string","const":"assistant","title":"Role","default":"assistant"},"content":{"items":{"$ref":"#/components/schemas/RLMResponsesOutputText"},"type":"array","title":"Content"}},"additionalProperties":false,"type":"object","required":["id","content"],"title":"RLMResponsesOutputMessage"},"RLMResponsesOutputText":{"properties":{"type":{"type":"string","const":"output_text","title":"Type","default":"output_text"},"text":{"type":"string","title":"Text"},"annotations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Annotations"}},"additionalProperties":false,"type":"object","required":["text"],"title":"RLMResponsesOutputText"},"RLMResponsesUsage":{"properties":{"input_tokens":{"type":"integer","title":"Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"}},"additionalProperties":false,"type":"object","required":["input_tokens","output_tokens","total_tokens"],"title":"RLMResponsesUsage"},"RLMResponsesError":{"properties":{"code":{"type":"string","title":"Code"},"message":{"type":"string","title":"Message"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"RLMResponsesError"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ManiacError","description":"Error payload."}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse","description":"Response body for errors."},"ManiacError":{"properties":{"code":{"type":"string","title":"Code","description":"Machine-readable error code."},"message":{"type":"string","title":"Message","description":"Human-readable error message."},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional error details."}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"ManiacError","description":"Standard Maniac API error envelope.\n\nThis matches the shape already used by v2 auth (`detail={\"error\": {...}}`)."}}},"paths":{"/v1/rlm/responses":{"post":{"tags":["RLM"],"summary":"Create an RLM response","description":"OpenAI Responses-style endpoint for Recursive Language Model execution. Accepts a strict subset of the Responses request shape and proxies to the internal RLM backend.","operationId":"rlm_responses_create","requestBody":{"content":{"application/json":{"schema":{"$defs":{"RLMControls":{"properties":{"engine":{"title":"Engine","description":"Execution engine to use. `classic` runs the iterative Maniac RLM, while `lambda` runs the deterministic lambda-style executor.","type":"string","enum":["classic","lambda"],"nullable":true},"max_depth":{"anyOf":[{"type":"integer","maximum":24,"minimum":1},{"type":"null"}],"title":"Max Depth","description":"Maximum recursion depth for the backend RLM worker. For `lambda`, this caps the planned decomposition depth."},"max_iterations":{"anyOf":[{"type":"integer","maximum":100,"minimum":1},{"type":"null"}],"title":"Max Iterations","description":"Maximum REPL iterations per recursion level. Used by `classic`."},"max_budget":{"anyOf":[{"type":"number","maximum":100,"minimum":0.01},{"type":"null"}],"title":"Max Budget","description":"Hard budget cap in USD."},"max_timeout":{"anyOf":[{"type":"number","maximum":1800,"minimum":10},{"type":"null"}],"title":"Max Timeout","description":"Hard timeout in seconds."},"enabled_tools":{"anyOf":[{"items":{"type":"string","enum":["browser_read_page","web_search"]},"type":"array"},{"type":"null"}],"title":"Enabled Tools","description":"Optional server-defined RLM tools to expose during execution, such as 'web_search' or 'browser_read_page'. For `classic`, omitting this field enables the backend defaults. For `lambda`, tools are opt-in and must be listed explicitly."},"tool_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Tool Config","description":"Optional per-tool configuration forwarded to the backend RLM API. When `engine` is `lambda`, this requires explicit `enabled_tools`."}},"additionalProperties":false,"type":"object","title":"RLMControls"},"RLMResponsesInputMessage":{"properties":{"type":{"type":"string","const":"message","title":"Type","default":"message"},"role":{"type":"string","enum":["user","assistant","system","developer"],"title":"Role","description":"Supported message role."},"content":{"anyOf":[{"type":"string"},{"items":{"$ref":"#/$defs/RLMResponsesInputText"},"type":"array"}],"title":"Content","description":"Text-only Responses message content."}},"additionalProperties":false,"type":"object","required":["role","content"],"title":"RLMResponsesInputMessage"},"RLMResponsesInputText":{"properties":{"type":{"type":"string","const":"input_text","title":"Type","default":"input_text"},"text":{"type":"string","title":"Text","description":"Text content for a Responses input part."}},"additionalProperties":false,"type":"object","required":["text"],"title":"RLMResponsesInputText"},"RLMResponsesReasoning":{"properties":{"effort":{"title":"Effort","description":"Reasoning effort forwarded to the backend RLM API.","type":"string","enum":["low","medium","high"],"nullable":true}},"additionalProperties":false,"type":"object","title":"RLMResponsesReasoning"}},"properties":{"model":{"type":"string","title":"Model","description":"Model slug to run through the RLM backend."},"input":{"anyOf":[{"type":"string"},{"items":{"$ref":"#/$defs/RLMResponsesInputMessage"},"type":"array"}],"title":"Input","description":"String input or a text-only array of Responses message items."},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instructions","description":"Optional top-level instructions mapped to the backend root prompt."},"background":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Background","description":"When true, start the RLM run in the background and return an in-progress response resource that can be retrieved later.","default":false},"reasoning":{"anyOf":[{"$ref":"#/$defs/RLMResponsesReasoning"},{"type":"null"}],"description":"Optional reasoning controls."},"metadata":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional metadata echoed in the gateway response."},"store":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Store","description":"Must be false or omitted. Stateful Responses storage is not supported."},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","description":"Must be false or omitted. Streaming is not supported for this route."},"rlm":{"anyOf":[{"$ref":"#/$defs/RLMControls"},{"type":"null"}],"description":"RLM-specific execution controls."}},"additionalProperties":false,"type":"object","required":["model","input"],"title":"RLMResponsesCreateRequest","description":"Strict OpenAI Responses-style request supported by the RLM gateway endpoint."}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RLMResponsesResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests","headers":{"X-RateLimit-Limit":{"description":"Request limit per window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Not Implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Upstream Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get an RLM response

> Retrieve a background RLM response resource by id within the authenticated project.

```json
{"openapi":"3.1.0","info":{"title":"Maniac Inference Gateway API","version":"1.0.0"},"tags":[{"name":"RLM","description":"Recursive Language Model endpoints."}],"servers":[{"url":"https://platform.maniac.ai","description":"The Maniac API"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key","description":"API key in Authorization header using Bearer <token>."}},"schemas":{"RLMResponsesResponse":{"properties":{"id":{"type":"string","title":"Id"},"object":{"type":"string","const":"response","title":"Object","default":"response"},"created_at":{"type":"integer","title":"Created At"},"status":{"type":"string","enum":["in_progress","completed","failed"],"title":"Status"},"model":{"type":"string","title":"Model"},"store":{"type":"boolean","const":false,"title":"Store","default":false},"metadata":{"additionalProperties":{"type":"string"},"type":"object","title":"Metadata"},"output":{"anyOf":[{"items":{"$ref":"#/components/schemas/RLMResponsesOutputMessage"},"type":"array"},{"type":"null"}],"title":"Output"},"output_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Text"},"usage":{"anyOf":[{"$ref":"#/components/schemas/RLMResponsesUsage"},{"type":"null"}]},"error":{"anyOf":[{"$ref":"#/components/schemas/RLMResponsesError"},{"type":"null"}]}},"additionalProperties":false,"type":"object","required":["id","created_at","status","model"],"title":"RLMResponsesResponse"},"RLMResponsesOutputMessage":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","const":"message","title":"Type","default":"message"},"status":{"type":"string","const":"completed","title":"Status","default":"completed"},"role":{"type":"string","const":"assistant","title":"Role","default":"assistant"},"content":{"items":{"$ref":"#/components/schemas/RLMResponsesOutputText"},"type":"array","title":"Content"}},"additionalProperties":false,"type":"object","required":["id","content"],"title":"RLMResponsesOutputMessage"},"RLMResponsesOutputText":{"properties":{"type":{"type":"string","const":"output_text","title":"Type","default":"output_text"},"text":{"type":"string","title":"Text"},"annotations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Annotations"}},"additionalProperties":false,"type":"object","required":["text"],"title":"RLMResponsesOutputText"},"RLMResponsesUsage":{"properties":{"input_tokens":{"type":"integer","title":"Input Tokens"},"output_tokens":{"type":"integer","title":"Output Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"}},"additionalProperties":false,"type":"object","required":["input_tokens","output_tokens","total_tokens"],"title":"RLMResponsesUsage"},"RLMResponsesError":{"properties":{"code":{"type":"string","title":"Code"},"message":{"type":"string","title":"Message"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"RLMResponsesError"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ManiacError","description":"Error payload."}},"additionalProperties":false,"type":"object","required":["error"],"title":"ErrorResponse","description":"Response body for errors."},"ManiacError":{"properties":{"code":{"type":"string","title":"Code","description":"Machine-readable error code."},"message":{"type":"string","title":"Message","description":"Human-readable error message."},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details","description":"Additional error details."}},"additionalProperties":false,"type":"object","required":["code","message"],"title":"ManiacError","description":"Standard Maniac API error envelope.\n\nThis matches the shape already used by v2 auth (`detail={\"error\": {...}}`)."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"paths":{"/v1/rlm/responses/{response_id}":{"get":{"tags":["RLM"],"summary":"Get an RLM response","description":"Retrieve a background RLM response resource by id within the authenticated project.","operationId":"rlm_responses_retrieve","parameters":[{"name":"response_id","in":"path","required":true,"schema":{"type":"string","title":"Response Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RLMResponsesResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"409":{"description":"Conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"429":{"description":"Too Many Requests","headers":{"X-RateLimit-Limit":{"description":"Request limit per window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining requests in current window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp when the rate limit resets.","schema":{"type":"integer"}},"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"501":{"description":"Not Implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Upstream Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://docs.maniac.ai/api-reference/rlm.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
