> ## 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 * [list\_container\_files](#list_container_files) - List container files * [get\_container\_file](#get_container_file) - Retrieve a container file * [download\_container\_file\_content](#download_container_file_content) - Download container file content * [promote\_container\_file](#promote_container_file) - Promote a container file into workspace documents ## list\_container\_files 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. ### Example Usage ```python theme={null} from openrouter import OpenRouter import os with OpenRouter( http_referer="", x_open_router_title="", x_open_router_categories="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: res = open_router.containers.list_container_files(container_id="sess_abc123", limit=100) # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | Example | | -------------------------- | ------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | | `container_id` | *str* | :heavy\_check\_mark: | The canonical container id, exactly as returned in a bash/shell tool result — a restarted session has its own `-r`-suffixed id. A session-derived id is always `sess_` + the sanitized session key, which is not necessarily the raw session id that was sent. | sess\_abc123 | | `http_referer` | *Optional\[str]* | :heavy\_minus\_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional\[str]* | :heavy\_minus\_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional\[str]* | :heavy\_minus\_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `limit` | *Optional\[int]* | :heavy\_minus\_sign: | Maximum number of files to return (1-1000). Defaults to 100 when absent. | 100 | | `after` | *Optional\[str]* | :heavy\_minus\_sign: | Forward cursor: a container file id from a previous page (typically `last_id`); listing resumes strictly after that file. | cfile\_b3V0L3JlcG9ydC5jc3Y | | `retries` | [Optional\[utils.RetryConfig\]](../../models/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. | | ### Response **[components.ContainerFileListResponse](../../components/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 | \*/\* | ## get\_container\_file Returns the metadata of a single file in a container. ### Example Usage ```python theme={null} from openrouter import OpenRouter import os with OpenRouter( http_referer="", x_open_router_title="", x_open_router_categories="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: res = open_router.containers.get_container_file(container_id="sess_abc123", file_id="cfile_b3V0L3JlcG9ydC5jc3Y") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | Example | | -------------------------- | ------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | | `container_id` | *str* | :heavy\_check\_mark: | The canonical container id, exactly as returned in a bash/shell tool result — a restarted session has its own `-r`-suffixed id. A session-derived id is always `sess_` + the sanitized session key, which is not necessarily the raw session id that was sent. | sess\_abc123 | | `file_id` | *str* | :heavy\_check\_mark: | Container file id (`cfile_` + base64url of the file path). | cfile\_b3V0L3JlcG9ydC5jc3Y | | `http_referer` | *Optional\[str]* | :heavy\_minus\_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional\[str]* | :heavy\_minus\_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional\[str]* | :heavy\_minus\_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `retries` | [Optional\[utils.RetryConfig\]](../../models/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. | | ### Response **[components.ContainerFile](../../components/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 | \*/\* | ## download\_container\_file\_content Streams the raw bytes of a file in a container. ### Example Usage ```python theme={null} from openrouter import OpenRouter import os with OpenRouter( http_referer="", x_open_router_title="", x_open_router_categories="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: res = open_router.containers.download_container_file_content(container_id="sess_abc123", file_id="cfile_b3V0L3JlcG9ydC5jc3Y") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | Example | | -------------------------- | ------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | | `container_id` | *str* | :heavy\_check\_mark: | The canonical container id, exactly as returned in a bash/shell tool result — a restarted session has its own `-r`-suffixed id. A session-derived id is always `sess_` + the sanitized session key, which is not necessarily the raw session id that was sent. | sess\_abc123 | | `file_id` | *str* | :heavy\_check\_mark: | Container file id (`cfile_` + base64url of the file path). | cfile\_b3V0L3JlcG9ydC5jc3Y | | `http_referer` | *Optional\[str]* | :heavy\_minus\_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional\[str]* | :heavy\_minus\_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional\[str]* | :heavy\_minus\_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `retries` | [Optional\[utils.RetryConfig\]](../../models/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. | | ### Response **[httpx.Response](../../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 | \*/\* | ## promote\_container\_file 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 ```python theme={null} from openrouter import OpenRouter import os with OpenRouter( http_referer="", x_open_router_title="", x_open_router_categories="", api_key=os.getenv("OPENROUTER_API_KEY", ""), ) as open_router: res = open_router.containers.promote_container_file(container_id="sess_abc123", file_id="cfile_b3V0L3JlcG9ydC5jc3Y") # Handle response print(res) ``` ### Parameters | Parameter | Type | Required | Description | Example | | -------------------------- | ------------------------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | | `container_id` | *str* | :heavy\_check\_mark: | The canonical container id, exactly as returned in a bash/shell tool result — a restarted session has its own `-r`-suffixed id. A session-derived id is always `sess_` + the sanitized session key, which is not necessarily the raw session id that was sent. | sess\_abc123 | | `file_id` | *str* | :heavy\_check\_mark: | Container file id (`cfile_` + base64url of the file path). | cfile\_b3V0L3JlcG9ydC5jc3Y | | `http_referer` | *Optional\[str]* | :heavy\_minus\_sign: | The app identifier should be your app's URL and is used as the primary identifier for rankings.
This is used to track API usage per application.
| | | `x_open_router_title` | *Optional\[str]* | :heavy\_minus\_sign: | The app display name allows you to customize how your app appears in OpenRouter's dashboard.
| | | `x_open_router_categories` | *Optional\[str]* | :heavy\_minus\_sign: | Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
| | | `retries` | [Optional\[utils.RetryConfig\]](../../models/utils/retryconfig.mdx) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. | | ### Response **[components.FileResponse](../../components/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.InternalServerResponseError | 500 | application/json | | errors.ServiceUnavailableResponseError | 503 | application/json | | errors.OpenRouterDefaultError | 4XX, 5XX | \*/\* |