Skip to content
NewDeepSeek V4.1 Flash 1017 Uncensored is live, with 1M tokens of context.Read the launch
Coding agents

Claude Code

Point Claude Code at XField with a few environment variables, keep your normal setup alongside it, and pick the right model for the job.

Claude Code speaks the Anthropic Messages API, and so does XField. Point it at our base URL, hand it your key, and choose a model. Tools, subagents, plan mode, hooks and MCP servers work as before. The difference is that the model does the task instead of explaining why it won't.

You need Claude Code installed and an API key from Settings › API keys. No key yet? Request access.

Quick setup

Export the variables in your shell, then start Claude Code from the same shell.

Shell
export XFIELD_API_KEY="sk-xf-v1-..."   # from Settings › API keys
 
export ANTHROPIC_BASE_URL="https://xfield.cloud.brutal.ai/api"
export ANTHROPIC_AUTH_TOKEN="$XFIELD_API_KEY"
export ANTHROPIC_MODEL="deepseek-v4.1-flash-1017-uncensored"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-5.3-flash-uncensored"
export ANTHROPIC_SMALL_FAST_MODEL="glm-5.3-flash-uncensored"
 
claude

What each one does:

VariablePurpose
ANTHROPIC_BASE_URLSends every request to XField. Claude Code appends /v1/messages.
ANTHROPIC_AUTH_TOKENYour key, sent as Authorization: Bearer. ANTHROPIC_API_KEY also works, but Claude Code asks you to approve it once.
ANTHROPIC_MODELThe main model for the session.
ANTHROPIC_DEFAULT_HAIKU_MODELThe cheap model for background work: titles, summaries, quick checks.
ANTHROPIC_SMALL_FAST_MODELThe older, deprecated name for the same thing. Set both if you share config across Claude Code versions.

While the token is set, Claude Code uses it instead of your claude.ai login. The login stays saved; unset the variables and you are back on your subscription. Remote Control and voice dictation need a claude.ai login, so they are off while you are pointed here.

Make it permanent

To apply the setup everywhere Claude Code runs, including background agents, put it in the env block of ~/.claude/settings.json:

~/.claude/settings.json
JSON
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://xfield.cloud.brutal.ai/api",
    "ANTHROPIC_AUTH_TOKEN": "sk-xf-v1-...",
    "ANTHROPIC_MODEL": "deepseek-v4.1-flash-1017-uncensored",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-5.3-flash-uncensored",
    "ANTHROPIC_SMALL_FAST_MODEL": "glm-5.3-flash-uncensored"
  }
}

Values in a settings file win over shell exports. Never put your key in a project's .claude/settings.json: that file gets committed. For one project only, use .claude/settings.local.json and make sure it is gitignored.

Keep normal Claude Code too

If you want claude to stay on your subscription, wrap the variables in a shell function instead and skip the settings file.

~/.zshrc
Shell
claude-field() {
  ANTHROPIC_BASE_URL="https://xfield.cloud.brutal.ai/api" \
  ANTHROPIC_AUTH_TOKEN="$XFIELD_API_KEY" \
  ANTHROPIC_MODEL="deepseek-v4.1-flash-1017-uncensored" \
  ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-5.3-flash-uncensored" \
  ANTHROPIC_SMALL_FAST_MODEL="glm-5.3-flash-uncensored" \
  claude "$@"
}

Now claude is the stock setup and claude-field runs on XField. Arguments pass through, so claude-field -c resumes the last session as usual.

Check the connection

Inside Claude Code, run /status. The Anthropic base URL line should show https://xfield.cloud.brutal.ai/api, and the auth line should name ANTHROPIC_AUTH_TOKEN. If the base URL line is missing, the variable did not reach the session. Then send any prompt.

To test the key on its own:

Shell
curl -sS "https://xfield.cloud.brutal.ai/api/v1/key" -H "Authorization: Bearer $XFIELD_API_KEY"

Pick a model

  • deepseek-v4.1-flash-1017-uncensored is the right choice for most coding sessions, including security work. It leads our models on coding and cybersecurity benchmarks, and long agent runs stay cheap because cached input is.
  • glm-5.3-uncensored has the longest output (128K). Use it for large code changes, long reports, or a second opinion from another model family.
  • glm-5.3-flash-uncensored is the lighter GLM. Good for the background model and for subagents.

Switch mid-session with /model glm-5.3-uncensored. To make the built-in aliases useful, map them:

Shell
export ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.3-uncensored"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4.1-flash-1017-uncensored"

Then /model opus and /model sonnet switch between them. See models for limits.

Tips

  • Effort. DeepSeek V4.1 Flash thinks at high effort by default. Change it with /effort or CLAUDE_CODE_EFFORT_LEVEL; each model maps the level to the ones it has. If Claude Code sends no level for a model, the model's default applies.
  • Subagents. Set CLAUDE_CODE_SUBAGENT_MODEL="glm-5.3-flash-uncensored" to run exploration subagents on the cheap model.
  • Long sessions. Every model here has a large context, but a focused context still works better. Use /compact when a session drifts and /clear between unrelated tasks.
  • Caching. Prompt caching is automatic. Keep CLAUDE.md stable during a session and avoid switching models back and forth: each switch starts a cold cache. Leave DISABLE_PROMPT_CACHING unset.