Skip to main content

Managing the cost of GitHub Codespaces in your organization

You can check your GitHub Codespaces usage and set usage limits.

Who can use this feature

To manage billing for GitHub Codespaces for an organization, you must be an organization owner or a billing manager.

Overview

Your organization is billed according to its compute and storage usage for GitHub Codespaces. This article explains the ways in which you, as an organization owner, can manage these costs.

To learn about pricing for GitHub Codespaces, see "About billing for GitHub Codespaces."

Spending limits

You can set a spending limit for GitHub Codespaces for your organization. This limit is applied to the total compute and storage cost for GitHub Codespaces. For more information, see "Managing spending limits for GitHub Codespaces."

  • Compute usage: This is the total time during which all GitHub Codespaces instances ("codespaces") were active in a billing month.

  • Storage usage: For GitHub Codespaces billing purposes, this includes all files used by all codespaces and prebuilds in your account. This includes resources such as cloned repositories, configuration files, and extensions, among others.

You can check the compute and storage usage for GitHub Codespaces for the current billing month. For information, see "Viewing your GitHub Codespaces usage"."

Note: Prebuilds for GitHub Codespaces are created and updated using GitHub Actions. This may incur billable costs for GitHub Actions. You can set a spending limit for GitHub Actions. For more information, see "About billing for GitHub Codespaces" and "Managing your spending limit for GitHub Actions." Storage of the generated prebuilds is charged at the same rate as your codespaces, and is included in your GitHub Codespaces spending limit.

Disabling or limiting Codespaces

You can disable all use of GitHub Codespaces that would be billed to your organization. Alternatively, you can specify which organization members or collaborators can use Codespaces at your organization's expense. For more information, see "Enabling GitHub Codespaces for your organization."

Note: If you disable billing for GitHub Codespaces for some organization members and collaborators, or for your entire organization, anyone who can either push changes to, or fork, a repository in your organization, will still be able to create a codespace for that repository by using their personal account. However, this will not incur any charge for your organization. For information about restricting access to a repository, see "Managing teams and people with access to your repository."

You can configure which repositories can be accessed from codespaces created for a particular repository. For more information, see "Managing access to other repositories within your codespace."

You can limit the choice of types of machine that are available for codespaces created from repositories owned by your organization. This allows you to prevent people using overly resourced machines for their codespaces, and incurring unnecessary charges. For more information, see "Restricting access to machine types."

You can set a maximum idle timeout constraint to limit the maximum timeout that people can set for codespaces that are billable to your organization. This can reduce the compute usage charges generated by codespaces that are left running in an idle state, by stopping active codespace after a shorter timeout period. For more information, see "Restricting the idle timeout period."

You can also restrict how long stopped codespaces can remain unused before they are automatically deleted. This can help to reduce storage costs for Codespaces. For more information, see "Restricting the retention period for codespaces."

Repository owners who set up prebuilds for their repository can reduce the storage costs of prebuilds by configuring these to be created only in selected regions. For more information, see "Configuring prebuilds."

Deleting unused codespaces

Your users can delete their own codespaces in https://github.com/codespaces and from within Visual Studio Code. To reduce the size of a codespace, users can manually delete files using the terminal or from within VS Code.

As an organization owner, you can delete any codespace in your organization. For more information, see "Deleting a codespace."

Note: Codespaces are automatically deleted after they have been stopped and have remained inactive for a user-definable number of days. For more information, see "Configuring automatic deletion of your codespaces." As an organization owner, you can set the maximum retention period for codespaces owned by your organization. This will override a user's personal retention setting. For more information, see "Restricting the retention period for codespaces."

Further reading