> ## Documentation Index > Fetch the complete documentation index at: https://openrouter.ai/docs/llms.txt > Use this file to discover all available pages before exploring further. # Containers > Containers endpoints ## Overview Containers endpoints ### Available Operations * [listContainerFiles](#listcontainerfiles) - List container files * [getContainerFile](#getcontainerfile) - Retrieve a container file * [downloadContainerFileContent](#downloadcontainerfilecontent) - Download container file content * [promoteContainerFile](#promotecontainerfile) - Promote a container file into workspace documents ## listContainerFiles Lists the files in a container, in lexicographic path order. The container id is the canonical id returned in bash/shell tool results; a restarted session is a separate container with its own id. Paginate with `limit` and `after` (pass the previous page’s `last_id`); `has_more: true` always means the next page is fetchable that way. `last_id` is the resume cursor: it is the last listed file’s id, except when a page ends at the per-request scan bound on hidden bookkeeping objects, where it names the scan position instead and may not appear in `data` (which can then be empty). ### Example Usage ```typescript theme={null} import { OpenRouter } from "@openrouter/sdk"; const openRouter = new OpenRouter({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const result = await openRouter.containers.listContainerFiles({ containerId: "sess_abc123", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript theme={null} import { OpenRouterCore } from "@openrouter/sdk/core.js"; import { containersListContainerFiles } from "@openrouter/sdk/funcs/containersListContainerFiles.js"; // Use `OpenRouterCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const openRouter = new OpenRouterCore({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const res = await containersListContainerFiles(openRouter, { containerId: "sess_abc123", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("containersListContainerFiles failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | - | - | - | - | | `request` | [operations.ListContainerFilesRequest](../../models/operations/listcontainerfilesrequest.mdx) | ✔️ | The request object to use for the request. | | `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.ContainerFileListResponse](../../models/containerfilelistresponse.mdx)>** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.ForbiddenResponseError | 403 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | ## getContainerFile Returns the metadata of a single file in a container. ### Example Usage ```typescript theme={null} import { OpenRouter } from "@openrouter/sdk"; const openRouter = new OpenRouter({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const result = await openRouter.containers.getContainerFile({ containerId: "sess_abc123", fileId: "cfile_b3V0L3JlcG9ydC5jc3Y", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript theme={null} import { OpenRouterCore } from "@openrouter/sdk/core.js"; import { containersGetContainerFile } from "@openrouter/sdk/funcs/containersGetContainerFile.js"; // Use `OpenRouterCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const openRouter = new OpenRouterCore({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const res = await containersGetContainerFile(openRouter, { containerId: "sess_abc123", fileId: "cfile_b3V0L3JlcG9ydC5jc3Y", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("containersGetContainerFile failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | - | - | - | - | | `request` | [operations.GetContainerFileRequest](../../models/operations/getcontainerfilerequest.mdx) | ✔️ | The request object to use for the request. | | `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.ContainerFile](../../models/containerfile.mdx)>** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.ForbiddenResponseError | 403 | application/json | | errors.NotFoundResponseError | 404 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | ## downloadContainerFileContent Streams the raw bytes of a file in a container. ### Example Usage ```typescript theme={null} import { OpenRouter } from "@openrouter/sdk"; const openRouter = new OpenRouter({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const result = await openRouter.containers.downloadContainerFileContent({ containerId: "sess_abc123", fileId: "cfile_b3V0L3JlcG9ydC5jc3Y", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript theme={null} import { OpenRouterCore } from "@openrouter/sdk/core.js"; import { containersDownloadContainerFileContent } from "@openrouter/sdk/funcs/containersDownloadContainerFileContent.js"; // Use `OpenRouterCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const openRouter = new OpenRouterCore({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const res = await containersDownloadContainerFileContent(openRouter, { containerId: "sess_abc123", fileId: "cfile_b3V0L3JlcG9ydC5jc3Y", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("containersDownloadContainerFileContent failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | - | - | - | - | | `request` | [operations.DownloadContainerFileContentRequest](../../models/operations/downloadcontainerfilecontentrequest.mdx) | ✔️ | The request object to use for the request. | | `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[ReadableStream\](../../models/.mdx)>** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.ForbiddenResponseError | 403 | application/json | | errors.NotFoundResponseError | 404 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* | ## promoteContainerFile Copies a file from the container's sandbox prefix into the workspace's durable document storage, so it outlives the container. Returns the new document in the Files API shape, with a durable file id in the documents namespace. The copy counts against the workspace's storage quota. Unlike a direct upload, promoted files are downloadable. ### Example Usage ```typescript theme={null} import { OpenRouter } from "@openrouter/sdk"; const openRouter = new OpenRouter({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const result = await openRouter.containers.promoteContainerFile({ containerId: "sess_abc123", fileId: "cfile_b3V0L3JlcG9ydC5jc3Y", }); console.log(result); } run(); ``` ### Standalone function The standalone function version of this method: ```typescript theme={null} import { OpenRouterCore } from "@openrouter/sdk/core.js"; import { containersPromoteContainerFile } from "@openrouter/sdk/funcs/containersPromoteContainerFile.js"; // Use `OpenRouterCore` for best tree-shaking performance. // You can create one instance of it to use across an application. const openRouter = new OpenRouterCore({ httpReferer: "", appTitle: "", appCategories: "", apiKey: process.env["OPENROUTER_API_KEY"] ?? "", }); async function run() { const res = await containersPromoteContainerFile(openRouter, { containerId: "sess_abc123", fileId: "cfile_b3V0L3JlcG9ydC5jc3Y", }); if (res.ok) { const { value: result } = res; console.log(result); } else { console.log("containersPromoteContainerFile failed:", res.error); } } run(); ``` ### Parameters | Parameter | Type | Required | Description | | - | - | - | - | | `request` | [operations.PromoteContainerFileRequest](../../models/operations/promotecontainerfilerequest.mdx) | ✔️ | The request object to use for the request. | | `options` | RequestOptions | ➖ | Used to set various options for making HTTP requests. | | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.mdx) | ➖ | Enables retrying HTTP requests under certain failure conditions. | ### Response **Promise\<[models.FileResponse](../../models/fileresponse.mdx)>** ### Errors | Error Type | Status Code | Content Type | | - | - | - | | errors.BadRequestResponseError | 400 | application/json | | errors.UnauthorizedResponseError | 401 | application/json | | errors.ForbiddenResponseError | 403 | application/json | | errors.NotFoundResponseError | 404 | application/json | | errors.PayloadTooLargeResponseError | 413 | application/json | | errors.TooManyRequestsResponseError | 429 | application/json | | errors.ClientClosedRequestResponseError | 499 | application/json | | errors.InternalServerResponseError | 500 | application/json | | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |