Use Claude Code with CoralBricks
Point Claude Code (or any Anthropic SDK) at CoralBricks and run open models — GLM and Kimi with up to 1M context — with zero client changes.
The CoralBricks gateway speaks the Anthropic Messages API at
POST /v1/messages. Anything built on Anthropic's SDKs — including
Claude Code — can switch to CoralBricks inference with two environment
variables.
Claude Code
export ANTHROPIC_BASE_URL="https://inference.coralbricks.ai"
export ANTHROPIC_AUTH_TOKEN="ak_..." # your CoralBricks key
export ANTHROPIC_MODEL="glm-5.2-fp4"
export ANTHROPIC_SMALL_FAST_MODEL="glm-5.2-fp4"
claude
That's the whole setup. The agent loop — file edits, shell commands, tool
calls, streaming — runs unmodified on the model you pick.
If you're logged into Claude Code with an Anthropic account, its stored
credential can outrank ANTHROPIC_API_KEY — use ANTHROPIC_AUTH_TOKEN
as shown (and unset ANTHROPIC_API_KEY) to make sure your CoralBricks
key wins.
Anthropic SDKs
import anthropic
client = anthropic.Anthropic(
base_url="https://inference.coralbricks.ai",
api_key="ak_...",
)
message = client.messages.create(
model="glm-5.2-fp4",
max_tokens=1000,
messages=[{"role": "user", "content": "Hello"}],
)
Both x-api-key (the SDK default) and Authorization: Bearer are accepted.
Available models
| Model |
Model ID |
Context |
Input $/M |
Output $/M |
| GLM 5.2 |
glm-5.2-fp4 |
1M |
$1.40 |
$4.40 |
| Kimi K3 |
kimi-k3 |
1M |
$3.00 |
$15.00 |
| Kimi K2.6 |
kimi-k2.6 |
256K |
$0.76 |
$4.00 |
| GPT-OSS 120B |
gpt-oss-120b |
128K |
$0.15 |
$0.60 |
Cached input tokens are always free — and they show up in the field
Anthropic clients already read: usage.cache_read_input_tokens. Claude
Code's own cost display reflects our cache economics directly.
What's supported
- Non-streaming and streaming (full Anthropic SSE event stream, including
fine-grained tool
input_json_delta)
- Tool use — client tools with
input_schema, tool_choice
(auto/any/tool/none), parallel tool calls
- System prompts (top-level and mid-conversation
system messages),
stop sequences, temperature/top_p
POST /v1/messages/count_tokens (estimator-backed, deliberately
biased slightly high)
anthropic-version/anthropic-beta headers and thinking/metadata/
cache_control params are accepted and ignored — prompt caching happens
automatically in the serving tier
Not supported (clean errors, not silent drops)
- Image and document content blocks (vision via this endpoint is coming)
- Server tools (web search, code execution, computer use), MCP connector,
containers — Claude Code's own tools all run client-side, so it is not
affected
- Extended thinking output — reasoning models think internally; reasoning
is not returned as
thinking blocks yet
The same key also works on the OpenAI-compatible surface —
OpenCode, Cursor, Cline —
and the full API reference is at /docs.