DEV Community

amdmsz
amdmsz

Posted on • Originally published at docs.byesu.com

I ran Claude Code on Grok 4.5 — here's the 3-line setup

I've basically lived inside Claude Code for the last few months. Opus 4.8 is my daily driver and I'm not looking to leave it. But when xAI dropped Grok 4.5 on July 8, two things nagged at me enough that I wanted it in the exact same terminal I already had open.

This is the write-up of that afternoon — what pulled me in, the three lines that actually did the job, and where I landed on Grok vs Opus after living with both for a week.

Why I even bothered

Two reasons, and neither of them is "it's the smartest model in the world," because it isn't.

One: it's built for coding. Grok 4.5 is the first xAI model explicitly aimed at coding and agentic work — xAI says it was trained on real developer sessions from Cursor, so the pitch is "long stretches of work inside an actual repo," which is exactly what Claude Code does all day.

Two: the token efficiency number stuck with me. In the third-party write-ups going around, Grok 4.5 finished the same agentic indexing task in roughly 14k output tokens where a frontier flagship burned closer to 67k. When you run an agent that loops and re-reads files for twenty minutes, output tokens are the bill. A model that says the same thing in a quarter of the tokens is interesting even before you look at the per-token rate.

Official rate, for the record: xAI lists Grok 4.5 at $2 / $6 per million input/output, and claims it comes in 60%+ under the current flagship tier. Fewer tokens and a lower rate stacks. That was enough to make me curious.

The thing I kept forgetting

Here's the part that took me embarrassingly long to internalize: Claude Code doesn't actually care what model is on the other end. It's a CLI that speaks Anthropic's /v1/messages protocol to whatever ANTHROPIC_BASE_URL points at. If something answers in that shape, Claude Code will happily drive it.

So I didn't need a Grok-specific client. I needed an endpoint that (a) speaks Anthropic-native and (b) has grok-4.5 sitting behind it. I already had an account on byesu, an API gateway that exposes both an OpenAI-compatible and an Anthropic-native endpoint over a pile of models — pay-as-you-go, and Grok 4.5 was already listed. That's the whole trick: the gateway translates, Claude Code never knows the difference.

The three lines

That's it. Literally three environment variables:

export ANTHROPIC_BASE_URL=https://byesu.com
export ANTHROPIC_API_KEY=sk-your-own-key
export ANTHROPIC_MODEL=grok-4.5
Enter fullscreen mode Exit fullscreen mode

Then, in any project directory:

claude
Enter fullscreen mode Exit fullscreen mode

ANTHROPIC_MODEL=grok-4.5 is the line doing the interesting work — it pins every request to Grok instead of the default Claude model, so you don't have to remember to switch each session. If you'd rather flip between models mid-session, drop that third line and use /model inside the REPL instead.

Two gotchas so you skip my afternoon

No /v1 on the base URL. The Anthropic-native endpoint is the bare root — https://byesu.com, not https://byesu.com/v1. I pasted in a /v1 out of muscle memory from OpenAI-style setups and got a wall of connection errors. Strip it.

If auth won't take, swap the key variable. On one machine my first call kept bouncing on auth. The fix was replacing ANTHROPIC_API_KEY with ANTHROPIC_AUTH_TOKEN (same value) — some Claude Code versions prefer one over the other. Thirty seconds once you know; a genuinely confusing ten minutes if you don't.

Sanity check before you trust it: run claude, ask it something trivial, and confirm the model line in the status bar reads grok-4.5. If it still says a Claude model, your ANTHROPIC_MODEL export didn't make it into that shell — re-source it or reopen the terminal.

The one-line vibe check

It's fast, and it's terse in a way I ended up liking. Grok 4.5 doesn't pad. It reads the files, makes the edit, and moves on with noticeably less "let me explain my reasoning at length" preamble — which, combined with the token-efficiency thing, means the agent loop just feels tighter. For mechanical work — wiring up a route, refactoring a module, chasing a stack trace across a few files — it kept pace with what I'd normally reach for.

Where I actually landed: Grok vs Opus 4.8

I'm not going to tell you Grok 4.5 replaces Opus 4.8, because after a week it clearly doesn't — for me they split by task, not by "better/worse."

Opus 4.8 is still where I go for the gnarly stuff: ambiguous architecture calls, "read this whole subsystem and tell me what's actually wrong," the reasoning-heavy work where I want the model to sit and think. It's the frontier flagship and it feels like it.

Grok 4.5 is where I go for volume. The high-frequency, well-specified, mechanical passes where I know roughly what needs to happen and I just want it done in fewer tokens and fewer words. On independent coding benchmarks it lands in the same neighborhood as the top-tier models at a fraction of the per-task cost, and Artificial Analysis had it at #4 on their intelligence index at launch — which is a lot of "good enough" for the kind of work that eats most of my day.

So it's complementary, not a swap. The nice part of the gateway setup is I don't have to commit: same three env vars, change the model line (or /model), and I'm on whichever one fits the task. Opus for the thinking, Grok for the grinding.

If you want the reference version of the setup — supported models, endpoints, the OpenAI-compatible side — it's documented over at docs.byesu.com. But honestly, the three lines above are the whole story. Export, claude, go.

Top comments (0)