Code Review and Code Generation
Run code review and code generation on Hal at $2 / $10 per 1M tokens. OpenAI and Anthropic compatible, so you change the base URL, key and model.
What drives the cost
Code review and code generation load the bill in different places. A review reads far more than it writes, because the model receives the instructions, the diff and the surrounding code and replies with a short list of findings. Generation writes much more per call than a review does, because it replies with tests, documentation or a rewritten module. On Hal an output token costs $10 per million and an input token costs $2, so input volume drives the cost of review and output volume drives the cost of generation.
The cost of one call is the input tokens multiplied by the input price, plus the output tokens multiplied by the output price, divided by one million. Current rates are on the pricing page, and the tokenomics page explains where the cost behind a token comes from.
Two worked examples to replace with your own numbers
The first is a pull request review in two passes. The first pass asks for every possible finding, and the second sends the same context plus those findings back and asks which are genuine.
| Assumption | Value |
|---|---|
| Review instructions and team standards, sent on every call | 3,000 tokens |
| Diff, about 400 changed lines | 6,000 tokens |
| Surrounding file context and call sites | 9,000 tokens |
| First pass, input and output | 18,000 and 1,200 tokens |
| Second pass, input and output | 19,200 and 600 tokens |
| Input tokens per review | 37,200 |
| Output tokens per review | 1,800 |
| Cost per review on Hal | $0.092 |
| Cost per 1,000 reviews | About $92 before prompt caching |
A pull request is rarely reviewed once. A pull request that is pushed to three times can trigger three reviews, so a team of 50 engineers who each merge 20 pull requests a month, at 2.5 reviews per pull request, runs 2,500 reviews and pays about $231 a month on Hal before prompt caching.
The second is generating unit tests for one function.
| Assumption | Value |
|---|---|
| Brief and style guide, sent on every call | 1,000 tokens |
| Function under test | 800 tokens |
| Related types, helpers and one existing test for style | 3,000 tokens |
| Input tokens per function | 4,800 |
| Output tokens per function, the tests | 1,500 |
| Cost per function on Hal | $0.025 |
| Cost per 10,000 functions | About $246 before prompt caching |
In the review example input is 95 percent of the tokens and 81 percent of the cost, so a tighter prompt and prompt caching matter most. In the generation example output is only 24 percent of the tokens but 61 percent of the cost, so asking for less code per call matters most. A review bot sends the same standards on every call, and prompt caching on the Anthropic-compatible endpoint can cut the cost of that repeated prompt by up to 90 percent.
A reviewer that explores the repository with tools reads far more than the example above. In a test published by Kilo, a review agent running Claude Opus 4.6 read 618,853 input tokens and wrote 6,142 output tokens on a 338-line pull request. At Hal's prices the same token counts would cost about $1.30, which is why input price decides the bill for agentic review.
Measure your own diffs before you plan around any of these numbers.
Which model to use
Hal is the default for code review and code generation. It is built for deep code generation, including large codebase refactoring and multi-file implementations, and it is the model to trust with the findings that matter: security-sensitive code, concurrency, database migrations, refactors that cross services and architecture planning. Hal is comparable to Opus 5.5 and GPT-6.1 Sol overall. Radium has not published a code-specific benchmark, so run the test in the section below before you move any traffic. Radium publishes matched-tier benchmark results against Claude on its own task suite.
Clarke takes the high-volume work that does not need Hal, such as unit tests, documentation, translating a function between languages and explaining an unfamiliar module. The two-pass review above costs about $0.036 on Clarke against $0.092 on Hal, so once the setup is proven, sending low-risk pull requests such as dependency bumps and copy changes to Clarke lowers the average cost per review.
Tycho does the work around the review. Use it to summarize a pull request, draft a commit message, apply labels, sort changes by risk and decide which pull requests go to Hal. It costs $0.10 per million input tokens and $1.50 per million output tokens, so summarizing the 6,000-token diff above with 1,000 tokens of instructions costs about $0.001.
| Step | Model | Model ID |
|---|---|---|
| Review comments, refactors, multi-file changes, security-sensitive code and architecture planning | Hal | hal-2.0 |
| Unit tests, documentation and low-risk pull requests | Clarke | clarke-1.0 |
| Pull request summaries, labels, commit messages and risk triage | Tycho | tycho-1.0 |
Route by the cost of a missed finding.
What this workload needs from the API
A review bot or coding assistant depends on a short list of API capabilities, and each one should be confirmed against your own client before production traffic moves.
| Capability | Why code review and generation need it | On Radium |
|---|---|---|
| Structured output | Returning findings with a file, line, severity and message as JSON that your CI can parse | JSON mode and JSON schema, on all three models |
| Tool calling | Fetching a file, a call site or a test result in the middle of a review | Supported on all three models, and your application runs the tools |
| Streaming | Showing generated code in an editor as it is written | Supported on all three models |
| Context window | Holding the diff, the files it touches and the standards | Hal 1,000,000 tokens, Clarke 200,000, Tycho 128,000 |
| Reasoning | Working through concurrency, edge cases and multi-step refactors | Hal and Clarke only |
| Prompt caching | Reusing the same standards and instructions on every call | cache_control on the Anthropic-compatible endpoint, on all models |
| Repeatable runs | Comparing two runs on the same diff | temperature, top_p and seed on the OpenAI-compatible endpoint |
Four things do not carry over unchanged. Radium does not support the Responses API, so a reviewer built on it has to call chat completions. Radium does not offer embeddings, so code search that relies on them keeps its current embedding provider. Model names from other providers return a model-not-found error until you change them to a Radium model ID. When reasoning is enabled, the response includes a thinking block before the text block, so read the last content block instead of the first.
Compare all three models on the model overview. The switching guide walks through a four-step evaluation against Anthropic and OpenAI, and the migration guide lists what changes and what stays the same. Long autonomous coding loops are covered on Radium's agent workflows page, and a review bot that reads a wiki or style guide on demand follows the pattern in Internal Copilots. More workloads are in the use cases index.
Check each row against your own client before the cutover.
How to switch
Radium serves OpenAI-compatible and Anthropic-compatible APIs, so an existing review bot or coding assistant keeps its SDK, its prompts, its tool definitions and its retry logic. Three values change, which are the base URL, the API key and the model name.
Pick the SDK you already use, then your language. The Anthropic SDK adds the /v1 path itself, so its base URL does not include it. Replace YOUR_API_KEY with your key.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.radium.cloud/v1",
)
response = client.chat.completions.create(
model="hal-2.0",
messages=[
{"role": "user", "content": "Hello, Radium!"}
],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.radium.cloud/v1",
});
const response: OpenAI.Chat.ChatCompletion =
await client.chat.completions.create({
model: "hal-2.0",
messages: [{ role: "user", content: "Hello, Radium!" }],
});
console.log(response.choices[0].message.content);curl https://api.radium.cloud/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "hal-2.0",
"messages": [{"role": "user", "content": "Hello, Radium!"}]
}'package main
import (
"context"
"fmt"
openai "github.com/sashabaranov/go-openai"
)
func main() {
cfg := openai.DefaultConfig("YOUR_API_KEY")
cfg.BaseURL = "https://api.radium.cloud/v1"
client := openai.NewClientWithConfig(cfg)
resp, err := client.CreateChatCompletion(
context.Background(),
openai.ChatCompletionRequest{
Model: "hal-2.0",
Messages: []openai.ChatCompletionMessage{
{Role: openai.ChatMessageRoleUser, Content: "Hello, Radium!"},
},
},
)
if err != nil {
panic(err)
}
fmt.Println(resp.Choices[0].Message.Content)
}import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.chat.completions.*;
OpenAIClient client = OpenAIOkHttpClient.builder()
.apiKey("YOUR_API_KEY")
.baseUrl("https://api.radium.cloud/v1")
.build();
ChatCompletion completion = client.chat().completions().create(
ChatCompletionCreateParams.builder()
.model("hal-2.0")
.addUserMessage("Hello, Radium!")
.build());
System.out.println(
completion.choices().get(0).message().content().orElseThrow());using OpenAI;
using OpenAI.Chat;
var client = new OpenAIClient(
new ApiKeyCredential("YOUR_API_KEY"),
new OpenAIClientOptions
{
Endpoint = new Uri("https://api.radium.cloud/v1"),
});
var chatClient = client.GetChatClient("hal-2.0");
var response = await chatClient.CompleteChatAsync(
new UserChatMessage("Hello, Radium!"));
Console.WriteLine(response.Value.Content[0].Text);import anthropic
client = anthropic.Anthropic(
api_key="YOUR_API_KEY",
base_url="https://api.radium.cloud",
)
message = client.messages.create(
model="hal-2.0",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Radium!"}
],
)
print(message.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.radium.cloud",
});
const message: Anthropic.Message = await client.messages.create({
model: "hal-2.0",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Radium!" }],
});
console.log(message.content[0].text);curl https://api.radium.cloud/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "hal-2.0",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Radium!"}]
}'Ask for findings as JSON
A review bot is easier to trust when a machine can check its output. This example asks Hal for findings that match a JSON schema at temperature 0, so your CI can reject any response that does not parse.
import json
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.radium.cloud/v1",
)
finding = {
"type": "object",
"properties": {
"file": {"type": "string"},
"line": {"type": "integer"},
"severity": {"type": "string", "enum": ["low", "medium", "high"]},
"message": {"type": "string"},
},
"required": ["file", "line", "severity", "message"],
}
schema = {
"name": "review_findings",
"schema": {
"type": "object",
"properties": {"findings": {"type": "array", "items": finding}},
"required": ["findings"],
},
}
diff = open("change.diff").read()
response = client.chat.completions.create(
model="hal-2.0",
temperature=0,
messages=[
{"role": "system", "content": "Report defects on changed lines only."},
{"role": "user", "content": diff},
],
response_format={"type": "json_schema", "json_schema": schema},
)
result = json.loads(response.choices[0].message.content)
for f in result["findings"]:
print(f["severity"], f["file"], f["line"], f["message"])Steps
- Create an account at deploy.radium.cloud and generate a key at deploy.radium.cloud/keys. New accounts get $25 in free credit, $5 on sign-up and $20 when a card is added.
- Set RADIUM_API_KEY as a secret in the CI job or service that runs your reviewer, and keep it out of the repository and out of browser code.
- Change the base URL and model name, then run the reviewer in shadow mode, with its comments going to a log or a private channel while your current provider keeps posting to pull requests.
- Compare the two sets of comments on the same pull requests, then switch the reviewer over.
The Radium docs list Claude Code and PydanticAI among the tools that connect by changing the base URL, and switching back means pointing the base URL at your previous provider. Guides for the OpenAI and Anthropic SDKs are in the Radium docs.
How to test it on your own pull requests
Cost is easy to compute and quality is the part that takes work, so test before you move anything. Take the last 200 pull requests your team merged, run each one through your current model and through Hal with the same prompt and the same context, and compare the output.
- Measure the noise first. Use temperature 0 on both sides and run each side twice, so you know how much of any difference is run-to-run variation before you blame the model.
- Score only what a machine can check. That means whether the output validates against the JSON schema, whether each finding points to a file and line that exist in the diff, and whether a generated test compiles and passes. Leave the quality of prose to people.
- Read the pairs that differ most. Sort the pull requests by how much the two outputs differ and read the top of the list side by side. A person decides which output is better, so a sort order that is slightly off costs nothing.
- Count what reviewers do with the findings. Findings that are accepted or fixed are the value, and findings that are dismissed are the false positives you pay for in attention.
Give the reviewer the code around the change as well as the change itself, because a model that sees only the diff flags problems that are handled a few lines away. Two passes also reduce false positives, with the first pass asking for every possible finding and the second asking which of them are genuine. G-Research describes this pattern for its own review tool, and the worked example above uses it.
Decide the threshold before you look at the results.
When Radium is the wrong choice
Radium fits when code review and routine code generation are a meaningful share of your AI spend and the tools you use accept a custom endpoint. There are cases where switching is the wrong move.
- Your coding tool does not let you set a base URL. Many editor assistants and hosted review products choose the model for you, and you can only change it if the tool accepts your own endpoint and key.
- Your volume is small. If the bill is a few hundred dollars a month, the evaluation will cost more than the switch saves.
- Your agent runs long autonomous loops that edit many files and run tests until the task passes. Radium has not published a code benchmark for this, so move one bounded step first, such as reviewing or writing tests, and measure it before you move the loop.
- Your workflow depends on the Responses API or on embeddings from the same provider. Radium does not offer either, so those calls stay where they are.
If none of these apply, run the comparison on your last 200 pull requests.
Frequently asked questions
Can I use Radium for AI code review without changing my review tooling?
Yes, if your tooling lets you set a base URL, an API key and a model name. Radium serves OpenAI-compatible and Anthropic-compatible APIs, so you point the SDK at https://api.radium.cloud/v1 for OpenAI-style calls or https://api.radium.cloud for Anthropic-style calls, and your prompts, tool definitions and retry logic stay the same.
Which Radium model is best for code review and code generation?
Use Hal (hal-2.0) for review comments, refactors, multi-file changes and security-sensitive code, Clarke (clarke-1.0) for unit tests, documentation and low-risk pull requests, and Tycho (tycho-1.0) for pull request summaries, labels and commit messages.
How much does AI code review cost on Radium?
Hal costs $2 per million input tokens and $10 per million output tokens. A two-pass review of a 400-line pull request, using about 37,200 input tokens and 1,800 output tokens, comes to roughly $0.092 before prompt caching, and a team of 50 engineers running 2,500 reviews a month would pay about $231.
Is Radium as good as Claude or GPT for coding?
Hal is comparable to Opus 5.5 and GPT-6.1 Sol overall, and Clarke is comparable to Sonnet 4.6 and GPT-5.4. Radium has not published a code-specific benchmark, so replay your own pull requests through both models, compare the outputs side by side and decide on your own results.
Does Radium train models on our source code?
No. Radium does not use customer data to train models. Data is encrypted in transit, and enterprise customers can request retention and residency details during a security review.
What does not work when I switch a coding tool to Radium?
Model names from other providers return a model-not-found error until you change them to hal-2.0, clarke-1.0 or tycho-1.0. The Responses API and embeddings are not available, so tools that depend on them need chat completions or a separate embedding provider. When reasoning is enabled, a thinking block comes first, so read the last content block of the response.