{
  "openapi": "3.0.1",
  "info": {
    "title": "Coding Agent Task Runner - Codex & OpenCode, Patch Out",
    "description": "Give a repository and a task, get a patch, changed files, test results and the agent's summary in one call. Codex CLI or OpenCode, models through Apify's OpenRouter proxy, no API key of your own.",
    "version": "0.1",
    "x-build-id": "LgBDpnepjY6bb0RQ5"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automa-flow~coding-agent-task-runner/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automa-flow-coding-agent-task-runner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/automa-flow~coding-agent-task-runner/runs": {
      "post": {
        "operationId": "runs-sync-automa-flow-coding-agent-task-runner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/automa-flow~coding-agent-task-runner/run-sync": {
      "post": {
        "operationId": "run-sync-automa-flow-coding-agent-task-runner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "repoUrl",
          "task"
        ],
        "properties": {
          "repoUrl": {
            "title": "Repository URL",
            "pattern": "^\\s*[Hh][Tt][Tt][Pp][Ss]://[^\\s@/?#]*\\.[^\\s@/?#]+/[^\\s?#]*[^\\s?#/][^\\s?#]*\\s*$",
            "maxLength": 2000,
            "type": "string",
            "description": "https:// clone URL of a Git repository, for example https://github.com/octocat/Hello-World. SSH, git@, file: and local paths are refused. Never put a token in the URL: use Git token below."
          },
          "task": {
            "title": "Task for the agent",
            "minLength": 10,
            "maxLength": 8000,
            "type": "string",
            "description": "What the agent should change, 10 to 8,000 characters, for example the body of a GitHub issue. The agent runs every command it decides on inside the run container, so treat the task like code you run."
          },
          "agent": {
            "title": "Agent",
            "enum": [
              "codex",
              "opencode"
            ],
            "type": "string",
            "description": "codex runs OpenAI's Codex CLI, opencode runs OpenCode. Both use the model below through Apify's OpenRouter proxy, so no API key of your own is needed. With the default model codex is the more reliable: in our tests opencode sometimes stopped early without changes.",
            "default": "codex"
          },
          "model": {
            "title": "Model",
            "pattern": "^[A-Za-z0-9~][A-Za-z0-9._:/@+~-]{0,199}$",
            "type": "string",
            "description": "OpenRouter model ID, for example deepseek/deepseek-v4-flash (default, cheap and passed our fixture with both agents) or a larger model for harder tasks. A model the proxy does not list ends MODEL_UNAVAILABLE before the agent starts, with no charge. Model tokens are billed by the proxy, outside this Actor's events.",
            "default": "deepseek/deepseek-v4-flash"
          },
          "gitRef": {
            "title": "Branch, tag or commit",
            "pattern": "^(?!.*\\.\\.)(?!.*//)(?!.*/\\.)(?!.*(?:/|\\.|\\.lock)$)[A-Za-z0-9_][A-Za-z0-9._/+-]{0,199}$",
            "type": "string",
            "description": "Branch or tag name, or a 40-character commit SHA. Empty means the repository's default branch."
          },
          "gitToken": {
            "title": "Git token",
            "type": "string",
            "description": "Read token for a private repository (a GitHub fine-grained token with Contents read, a GitLab read_repository token). Used only for the clone; never given to the agent or the test command, never written to .git/config and removed from every log and output."
          },
          "testCommand": {
            "title": "Test command",
            "maxLength": 500,
            "type": "string",
            "description": "Optional shell command run with bash -lc in the repository after the agent, for example npm test or pytest -q. Its exit code becomes testsPassed; failing tests still return the patch (status DONE). Up to 500 characters."
          },
          "testTimeoutSeconds": {
            "title": "Test timeout (seconds)",
            "minimum": 10,
            "maximum": 1800,
            "type": "integer",
            "description": "Wall time for the test command, 10-1,800. Test time counts toward billed agent minutes.",
            "default": 300
          },
          "maxMinutes": {
            "title": "Max agent minutes",
            "minimum": 1,
            "maximum": 60,
            "type": "integer",
            "description": "Deadline for the agent, 1-60 minutes. At the deadline the agent is stopped and the patch so far is returned with status TIMEOUT. A smaller maxTotalChargeUsd shortens it to what the budget covers.",
            "default": 10
          },
          "maxModelRequests": {
            "title": "Max model requests",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Model calls the agent may make, 1-2,000. This bounds your token bill. After the limit the agent is stopped and the patch so far is returned with status REQUEST_LIMIT.",
            "default": 200
          },
          "includeUntracked": {
            "title": "Include new files",
            "type": "boolean",
            "description": "Include files the agent created in patch.diff. Turn off to return only changes to files already in the repository.",
            "default": true
          },
          "failRunOnError": {
            "title": "Fail the run when the task is not done",
            "type": "boolean",
            "description": "When on, the run ends FAILED after storing the row and RUN_SUMMARY if the status is not DONE or NO_CHANGES, so an n8n or Make step stops. When off, pipelines branch on the status field.",
            "default": false
          },
          "secrets": {
            "title": "Secrets (environment variables)",
            "maxProperties": 50,
            "type": "object",
            "description": "Environment variables for the agent and the test command, for example {\"NPM_TOKEN\": \"...\"} for a private package registry. Stored encrypted and removed from logs, the row and KVS files. Up to 50 keys of A-Z, 0-9 and _; names starting with APIFY_, ACTOR_, CRAWLEE_, CATR_, GIT_, CODEX_, OPENCODE_, XDG_, LD_ or LC_ and system names such as HOME or PATH are refused."
          },
          "resource": {
            "title": "Integration resource",
            "type": "object",
            "description": "Present on some webhook bodies; not read."
          },
          "payload": {
            "title": "Integration payload",
            "type": "object",
            "description": "Added by Actor-to-Actor integrations; not read."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}