BlogClaude Code

Claude Code sign-in with company SSO through LiteLLM

Developers can sign in to Claude Code with their company account, without ever holding an API key. The LiteLLM gateway handles the sign-in through your identity provider and gives Claude Code a session that belongs to one user and one team. You switch on one setting in the gateway and roll out one settings file to the laptops. Before you rely on it, know how long a session lives and what removing a user in the identity provider does not do. As of 27 November 2026.

By Updated

What you need

  • Claude Code 2.1.195 or newer on the developers' machines.
  • LiteLLM 1.106.0 or newer for session renewal and sign-out. From 1.109.0 a developer who belongs to several teams can choose one at sign-in.
  • Single sign-on already working for the LiteLLM admin UI. Entra ID, Google, Okta and any OpenID Connect provider are supported. Beyond five users, SSO needs a LiteLLM Enterprise licence.
  • Redis as soon as the gateway runs on more than one replica.
  • A gateway address that resolves to a private network address and is served over TLS.

Setting it up

On the gateway, the setting goes into the config file. It cannot be switched on in the admin UI. Claude Code also needs a model entry it can reach, and a wildcard for Anthropic models is the simplest one.

LiteLLM configuration for Claude Code sign-in
general_settings:
  enable_claude_code_gateway: true

model_list:
  - model_name: "anthropic/*"
    litellm_params:
      model: "anthropic/*"
      api_key: os.environ/ANTHROPIC_API_KEY

On the laptops, a managed settings file tells Claude Code to sign in through the gateway and nowhere else. Your device management distributes it. On macOS it lives at /Library/Application Support/ClaudeCode/managed-settings.json, on Linux at /etc/claude-code/managed-settings.json and on Windows at C:\Program Files\ClaudeCode\managed-settings.json.

Managed settings file for Claude Code
{
  "forceLoginMethod": "gateway",
  "forceLoginGatewayUrl": "https://llm.example.internal/claude_code_gateway"
}

The developer then starts claude or runs /login, signs in with the company account in the browser and confirms a code. From that point every request carries their identity.

What a session is

A session is tied to one user and one team. Spend, budgets and logs are attributed to them, and the models they can use are the ones on the team's list. That makes cost allocation a by-product of signing in.

Lifetimes in a Claude Code gateway session, from LiteLLM's documentation, checked on 27 November 2026
WhatDefaultNote
Session token24 hoursConfigurable up to 336 hours. It cannot be revoked before it expires
RenewalFive minutes before expiryThe gateway checks the user and the team in LiteLLM again
Refresh token14 daysSingle use. /logout revokes it

Offboarding and sign-out

This is the part to test before you tell security that access is tied to the company account. Three things are easy to assume and are not so.

  • Removing someone in the identity provider does not end their session. Renewal checks the user and the team in LiteLLM. Remove the user there as well, or automate it with SCIM.
  • /logout revokes the refresh token and not the session token. The session token stays valid until it expires.
  • A long session lifetime is a long offboarding delay. With the default of 24 hours, a removed user can work for up to a day. If that is too long for you, shorten the lifetime.

Redis matters here too. While Redis is unreachable, renewal and sign-out fail on a gateway with several replicas.

Limits and alternatives

Two things behave differently on a gateway session. Server-side web search is disabled, and the prompt cache lifetime is five minutes. Check both against how your developers work before you roll out.

If your versions are older or you do not want SSO on the gateway yet, there are two other routes. LiteLLM's own command-line tool can sign a developer in and then start Claude Code. Or each developer gets a virtual key, which Claude Code reads from an environment variable or a helper script. The key route works in the open-source version and needs no SSO, at the price of keys on laptops that someone has to rotate.

Questions

Can developers use Claude Code without an API key?

Yes. With gateway sign-in they authenticate with the company account through LiteLLM and receive a session. No API key is stored on the laptop.

Does Claude Code SSO through LiteLLM work with Entra ID?

Yes. It uses the same single sign-on configuration as the LiteLLM admin UI, which supports Entra ID, Google, Okta and any OpenID Connect provider.

How quickly does a removed user lose access to Claude Code?

At the next renewal after the user is removed in LiteLLM, which is within 24 hours by default. The current session token cannot be revoked early, so set a shorter lifetime if you need a faster cut-off.

Talk to an engineer

Bring one piece of work you would like to improve. The call takes 30 minutes and needs no access to your systems or your data.

Booking runs on Google Calendar.

Mickey Graf

Mickey Graf

Founder and CEO of Cloudsail

Rated 4.9 out of 5 on Clutch

Prefer to write first? Leave your email and a few lines. Mickey reads every message himself and replies by email with times for a call.

The button prepares an email in your own email program, for you to send. Privacy policy (draft)