Skip to main content
Claude Code is Anthropic’s coding agent for the terminal. It sends its requests in the Anthropic Messages format, which the SinarCloud AI API also accepts. Set a few environment variables, and Claude Code runs on the SinarCloud models you choose, such as deepseek/deepseek-v4-1-flash. You pay per token from your SinarCloud balance, so you don’t need a Claude subscription. This guide was last checked with Claude Code 2.1.311 in the terminal and Claude Code for VS Code 2.1.312.
Anthropic doesn’t support running Claude Code on models other than Claude. Most features work with SinarCloud models, and the differences are listed under What works differently.

Before you start

Use Claude Code in the terminal

1

Choose your models

Claude Code needs a main model, plus a model for each of its fable, opus, sonnet, and haiku model names. In the console, under AI, click Models, then click Details on a model. Check that Model capabilities lists Chat completions, Tool use, and Streaming. Then click the copy icon next to the alias to copy it.This guide uses deepseek/deepseek-v4-1-flash as the main model and for sonnet and haiku, and deepseek/deepseek-v4-pro for fable and opus.
The details dialog for DeepSeek V4.1 Flash with its alias deepseek/deepseek-v4-1-flash and a copy icon, its prices per 1M tokens, its context window and maximum output, and Model capabilities that include Chat completions, Tool use, and Streaming

Check the capabilities and copy the alias

2

Point Claude Code at SinarCloud

Claude Code’s base URL is https://ai.sinarcloud.com, without /v1. Claude Code adds /v1/messages to the base URL itself. In the terminal where you set SINARCLOUD_API_KEY, run:
A terminal after eight export commands: SINARCLOUD_API_KEY set to the placeholder paste-your-api-key, ANTHROPIC_BASE_URL set to https://ai.sinarcloud.com, ANTHROPIC_AUTH_TOKEN set to $SINARCLOUD_API_KEY, ANTHROPIC_MODEL set to deepseek/deepseek-v4-1-flash, the Fable and Opus models set to deepseek/deepseek-v4-pro, and the Sonnet and Haiku models set to deepseek/deepseek-v4-1-flash

The variables set in the terminal, after SINARCLOUD_API_KEY

Here’s what each variable does:
  • ANTHROPIC_BASE_URL is Claude Code’s base URL, without /v1.
  • ANTHROPIC_AUTH_TOKEN is your SinarCloud API key. Claude Code sends it in the Authorization header and uses it right away, without asking you to approve it.
  • ANTHROPIC_MODEL is the model Claude Code starts with.
  • ANTHROPIC_DEFAULT_FABLE_MODEL, ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, and ANTHROPIC_DEFAULT_HAIKU_MODEL set the SinarCloud models behind Claude Code’s fable, opus, sonnet, and haiku model names, which appear in its model list. Claude Code also uses these names for background tasks and subagents, and its own models with these names don’t exist on SinarCloud, so set all four.
Replace the aliases with the models you chose.
3

Check the connection

Before you open Claude Code, send one small request from the same terminal to check the URL and key:
A reply with a content list means the URL and key work. If you get an error instead:
  • unsupported_endpoint: ANTHROPIC_BASE_URL ends in /v1. Set it to https://ai.sinarcloud.com and try again.
  • authentication_error with “Invalid API key.”: the key is missing, mistyped, expired, or revoked.
  • not_found_error with a message that starts with model:: the model alias is wrong, or the model isn’t available right now.
4

Start Claude Code

In the same terminal, go to your project folder and start Claude Code:
Claude Code doesn’t ask you to sign in to a Claude account, because ANTHROPIC_AUTH_TOKEN is set. The first time you start it, it asks a few setup questions instead:
  1. Under Choose the text style that looks best with your terminal, select a style, such as Light mode, and press Enter.
  2. Read the Security notes and press Enter.
  3. If Claude Code asks Use Claude Code’s terminal setup?, choose either option. It sets up Shift+Enter for new lines in your terminal.
The first time you start Claude Code in a folder, it asks whether you trust the folder. No, exit is selected at first. Press the down arrow to select Yes, I trust this folder, then press Enter.
Claude Code's quick safety check asking whether this is a project you created or one you trust, with the options No, exit and Yes, I trust this folder, and Yes, I trust this folder selected

Trust the project folder to continue

5

Check the model on the welcome screen

Claude Code opens. Its header shows your model, deepseek/deepseek-v4-1-flash, with API Usage Billing, above your project folder.Below the header, Claude Code warns that the model isn’t recognized and that the context is assumed to be 200k tokens. That’s expected. See Context window.
Claude Code v2.1.311 started in ~/demo-shop. The header shows deepseek/deepseek-v4-1-flash · API Usage Billing. Below it are a warning that the model isn't recognized and the context is assumed to be 200k tokens, a notice that auto mode is now the default permission mode, and an empty prompt.

Claude Code runs on your SinarCloud model

6

Check the base URL in /status

Type /status and press Enter. On the Status tab, check two lines:
  • Anthropic base URL shows https://ai.sinarcloud.com.
  • Auth token shows ANTHROPIC_AUTH_TOKEN, the variable that holds your key.
The Model line shows the model Claude Code uses. Press Esc to close the screen.
The Status tab of /status listing Auth token: ANTHROPIC_AUTH_TOKEN, Anthropic base URL: https://ai.sinarcloud.com, Model: deepseek/deepseek-v4-1-flash, IDE: Connected to VS Code extension version 2.1.312, and Setting sources: User settings, with managed settings and organization policy not fetched with a custom ANTHROPIC_BASE_URL

/status shows the SinarCloud base URL

7

Give Claude Code a task

Type a task, such as a change you want in a file, and press Enter.To see what Claude Code used, open AI > Usage in the console and choose the key you created for Claude Code in the API key filter.
The Log & Usage page with the Date range, Model, and API key filters, cards of totals, and the Log tab's table of recent requests

Choose your Claude Code key in the API key filter

8

Save the settings

Variables you set in a terminal last until you close it. To use SinarCloud every time you start Claude Code, put the same values in the env block of your Claude Code user settings file: ~/.claude/settings.json on macOS and Linux, or %USERPROFILE%\.claude\settings.json on Windows.After your first run, the file already exists and holds the text style you chose, such as "theme": "light". Add the env block inside its outer braces, and put a comma after the line before it. If the file doesn’t exist, create it. Paste your full API key:
~/.claude/settings.json
~/.claude/settings.json open in an editor with theme set to light and an env block that sets ANTHROPIC_BASE_URL to https://ai.sinarcloud.com, ANTHROPIC_AUTH_TOKEN to paste-your-api-key, ANTHROPIC_MODEL to deepseek/deepseek-v4-1-flash, the Fable and Opus models to deepseek/deepseek-v4-pro, and the Sonnet and Haiku models to deepseek/deepseek-v4-1-flash

The env block in ~/.claude/settings.json

When the settings file and your terminal set the same variable, the settings file wins.
Don’t put your API key in a project’s .claude/settings.json. That file is usually committed to the repository and shared with everyone who clones it.

Use Claude Code in VS Code

Claude Code also comes as a VS Code extension, which opens Claude Code in a panel next to your code. It uses the same variables as the terminal, but you set them in VS Code’s settings.
1

Install the extension

In VS Code, open the Extensions view with Ctrl+Shift+X (Cmd+Shift+X on macOS) and search for Claude Code for VS Code. Click Install on the Claude Code for VS Code extension published by Anthropic.
The Extensions view searched for Claude Code for VS Code, with the Claude Code for VS Code listing by Anthropic, its verified badge, and an Install button

Install Claude Code for VS Code, published by Anthropic

2

Turn off the sign-in prompt

Open VS Code’s settings with Ctrl+, (Cmd+, on macOS), search for Claude Code login, and check Disable Login Prompt.
The Claude Code: Disable Login Prompt setting with its checkbox checked, described as: When true, never prompt for login/authentication in the extension. Used when authentication is handled externally.

Check Disable Login Prompt

3

Add the SinarCloud variables

Open the Command Palette with Ctrl+Shift+P (Cmd+Shift+P on macOS) and run Preferences: Open User Settings (JSON). The checkbox in the previous step added "claudeCode.disableLoginPrompt": true to this file. Add the claudeCode.environmentVariables setting after it, with the base URL https://ai.sinarcloud.com, your API key, and your models. Both keys go inside the file’s outer braces:
settings.json
settings.json in VS Code with claudeCode.disableLoginPrompt set to true and claudeCode.environmentVariables listing ANTHROPIC_BASE_URL with the value https://ai.sinarcloud.com, ANTHROPIC_AUTH_TOKEN with paste-your-api-key, ANTHROPIC_MODEL with deepseek/deepseek-v4-1-flash, the Fable and Opus models with deepseek/deepseek-v4-pro, and the Sonnet and Haiku models with deepseek/deepseek-v4-1-flash

The two keys in settings.json

The extension checks for a key in this setting before it starts Claude Code, so put your key here even if you saved it in ~/.claude/settings.json. Save the file, then restart VS Code so the extension picks up the new values.
If VS Code is connected to a remote machine, such as your VPS over Remote - SSH, run Preferences: Open Remote Settings (JSON) instead and add claudeCode.environmentVariables there. In a remote window, VS Code greys out this setting in your user settings and doesn’t pass it to the extension, so the panel lists Claude models.
VS Code saves these settings as plain text in your user profile, and Settings Sync can copy them to your other computers. Don’t put your API key in a workspace’s .vscode/settings.json, which is often committed to the repository.
4

Open Claude Code

Click the Claude Code icon (✻) in the editor toolbar or the Activity Bar, or click ✻ Claude Code in the status bar. The panel opens next to your code without a sign-in screen, and the model under the prompt box shows your SinarCloud model.
VS Code with src/server.js open on the left and the Claude Code panel on the right. The panel's prompt box shows the model deepseek/deepseek-v4-1-flash and the open file server.js attached.

Claude Code in VS Code, running on a SinarCloud model

5

Switch models in the panel

To switch models, click the model under the prompt box. The list shows the SinarCloud models you set, as the custom Opus, Fable, Sonnet, and Haiku models.
Claude Code's Select a model list with Default (recommended) using deepseek/deepseek-v4-pro[1m], deepseek/deepseek-v4-pro as the custom Opus and Fable models, and deepseek/deepseek-v4-1-flash as the custom Sonnet and Haiku models, above the Effort and Ultracode settings

The model list shows your SinarCloud models

To see what Claude Code used, open AI > Usage in the console and choose its key in the API key filter.

Switch models

To switch to another SinarCloud model during a session, run /model followed by the model’s alias:
To start Claude Code on a different model, run claude --model followed by the alias. Compare prices on the Models page first, because every step of Claude Code’s work is a separate request.

Context window

Claude Code doesn’t recognize SinarCloud model aliases, so it assumes a context window of 200K tokens and compacts the conversation when it reaches that size. A model’s real window is shown under Context window (tokens) in its details on the Models page. The 200K default keeps requests smaller and cheaper, because Claude Code sends the whole conversation with every request. To let a session grow larger before Claude Code compacts it, set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the model’s window, the same way you set the other variables. For example, for a model with a 1,000,000-token window:

What works differently

  • Web search doesn’t work. Claude Code’s web search runs on the API side, which SinarCloud doesn’t offer.
  • PDFs and other documents aren’t sent. SinarCloud doesn’t accept them, so Claude Code leaves them out and tries again. To work with a document, convert it to text first.
  • Images need a model with image input. If the model doesn’t list Image input or Vision, Claude Code leaves the image out and tries again.
  • Claude account features aren’t available. Features that need a Claude account or Anthropic’s servers, such as Remote Control, cloud sessions, and fast mode, don’t work, and Claude subscription limits don’t apply. You pay for each request from your SinarCloud balance. See Anthropic’s feature availability page.
See Compatibility for details.

Troubleshooting

Claude Code shows this message for two different problems:
  • ANTHROPIC_BASE_URL ends in /v1, so requests go to the wrong address. Set it to https://ai.sinarcloud.com in your terminal and in ~/.claude/settings.json.
  • The model alias in the message doesn’t exist or isn’t available right now. Copy the alias again from the Models page, check all the ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_*_MODEL variables, and check that the model lists Chat completions.
Claude Code retries for a few minutes before it shows this message. The key in ANTHROPIC_AUTH_TOKEN is missing, mistyped, expired, or revoked. If you saved the key in ~/.claude/settings.json, check it there too, because that value wins over your terminal. If the key has expired or been revoked, create a new one.
Add balance, then send your message again.
Claude Code tried to use a tool that runs on the API side, such as web search. Ask Claude Code to continue without it.
Claude Code didn’t find ANTHROPIC_AUTH_TOKEN when it started. Set the variables in the terminal before you run claude, or save them in ~/.claude/settings.json. A project’s settings files apply only after Claude Code’s first-run setup, so they don’t prevent this prompt.
The extension didn’t get the SinarCloud variables. Check that Disable Login Prompt is checked and that claudeCode.environmentVariables is in your user settings, not a workspace’s settings. If VS Code is connected to a remote machine, put claudeCode.environmentVariables in the remote settings instead, with Preferences: Open Remote Settings (JSON). Then restart VS Code, because the extension reads these settings when it starts.
You’re also signed in to a Claude account. Claude Code uses ANTHROPIC_AUTH_TOKEN for requests, but the saved sign-in can cause unexpected behavior. To use only your SinarCloud key, run /logout.
For other problems, see Troubleshooting and Anthropic’s guide to connecting Claude Code to an LLM gateway.