Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
5763b4a
feat(providers): add CoralBricks as a native provider
Oct 5, 2026
88814a9
test(coralbricks): harden cost map consistency tests
Oct 5, 2026
5f5db59
test(coralbricks): type cost helpers, read cost maps from disk, cover…
Oct 6, 2026
f8568e3
test(coralbricks): drop Final on loop-rebound names
Oct 6, 2026
c789c5c
test(coralbricks): add the provider audit cells, the Add Model browse…
mateo-berri Oct 6, 2026
07dc9e8
Merge remote-tracking branch 'origin/main' into litellm_coralbricks_p…
Oct 8, 2026
430c736
test(coralbricks): derive UI spend from model info, type browser rows…
Oct 8, 2026
9f9a8be
test(coralbricks): release held upstream before the wire server joins…
Oct 8, 2026
35f9b6f
test(coralbricks): number forwarded chats with itertools.count instea…
Oct 8, 2026
18ffd76
fix(coralbricks): drop retired glm-5.3-flash-fp4 and test against dee…
Oct 8, 2026
1dfd035
test(coralbricks): pin retries, await the respawned worker, read the …
mateo-berri Oct 9, 2026
cb1a23d
fix(coralbricks): price the current model names and the new DeepSeek …
mateo-berri Oct 10, 2026
efb24af
fix(coralbricks): keep pricing for the deprecated fp4 slugs CoralBric…
mateo-berri Oct 10, 2026
a4fb718
fix(coralbricks): list the catalog rows for wildcard deployments and …
mateo-berri Oct 12, 2026
93c5048
Merge remote-tracking branch 'origin/main' into litellm_coralbricks_p…
mateo-berri Oct 12, 2026
d5bbab5
fix(coralbricks): price the deprecated glm-5.3 and deepseek-v4.1-flas…
mateo-berri Oct 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ Set `LITELLM_PROXY_API_BASE` and `LITELLM_PROXY_API_KEY` and every model call th
| [Cohere Chat (`cohere_chat`)](https://docs.litellm.ai/docs/providers/cohere) | ✅ | ✅ | ✅ | | | | | | | |
| [CometAPI (`cometapi`)](https://docs.litellm.ai/docs/providers/cometapi) | ✅ | ✅ | ✅ | ✅ | | | | | | |
| [CompactifAI (`compactifai`)](https://docs.litellm.ai/docs/providers/compactifai) | ✅ | ✅ | ✅ | | | | | | | |
| [CoralBricks (`coralbricks`)](https://docs.litellm.ai/docs/providers/coralbricks) | ✅ | ✅ | ✅ | | | | | | | |
| [Custom (`custom`)](https://docs.litellm.ai/docs/providers/custom_llm_server) | ✅ | ✅ | ✅ | | | | | | | |
| [Custom OpenAI (`custom_openai`)](https://docs.litellm.ai/docs/providers/openai_compatible) | ✅ | ✅ | ✅ | | | ✅ | ✅ | ✅ | ✅ | |
| [Dashscope (`dashscope`)](https://docs.litellm.ai/docs/providers/dashscope) | ✅ | ✅ | ✅ | ✅ | | | | | | ✅ |
Expand Down
2 changes: 2 additions & 0 deletions litellm/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@
"https://api.meta.ai/v1",
"https://api.sailresearch.com/v1",
"https://api.cognition.ai/v1",
"https://inference.coralbricks.ai/v1",
"https://api.cortecs.ai/v1",
"https://api.scx.ai/v1",
"https://api.prisminference.com/v1",
Expand Down Expand Up @@ -1046,6 +1047,7 @@
"darkbloom",
"meta", # Meta Model API (Muse Spark) - JSON-configured provider
"cognition",
"coralbricks",
"cortecs",
"scx-ai",
"prism",
Expand Down
6 changes: 6 additions & 0 deletions litellm/llms/openai_like/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@
"api_key_env": "COGNITION_API_KEY",
"api_base_env": "COGNITION_API_BASE"
},
"coralbricks": {
"base_url": "https://inference.coralbricks.ai/v1",
"api_key_env": "CORALBRICKS_API_KEY",
"api_base_env": "CORALBRICKS_API_BASE",
"supported_endpoints": ["/v1/chat/completions", "/v1/responses", "/v1/messages"]
},
"cortecs": {
"base_url": "https://api.cortecs.ai/v1",
"api_key_env": "CORTECS_API_KEY",
Expand Down
46 changes: 46 additions & 0 deletions litellm/model_prices_and_context_window_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -16429,6 +16429,52 @@
"supports_function_calling": true,
"supports_tool_choice": true
},
"coralbricks/glm-5.3-fp4": {
"cache_creation_input_token_cost": 1.68e-06,
"cache_read_input_token_cost": 0.0,
"input_cost_per_token": 1.12e-06,
"litellm_provider": "coralbricks",
"max_input_tokens": 1048576,
"max_tokens": 1048576,
"mode": "chat",
"output_cost_per_token": 4.4e-06,
"source": "https://www.coralbricks.ai/pricing",
"supported_endpoints": [
"/v1/chat/completions",
"/v1/responses",
"/v1/messages"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"coralbricks/deepseek-v4.1-flash-fast-fp4": {
"cache_creation_input_token_cost": 9e-08,
"cache_read_input_token_cost": 0.0,
"input_cost_per_token": 3e-07,
"litellm_provider": "coralbricks",
"max_input_tokens": 1048576,
"max_tokens": 1048576,
"mode": "chat",
"output_cost_per_token": 1.2e-06,
"source": "https://www.coralbricks.ai/pricing",
"supported_endpoints": [
"/v1/chat/completions",
"/v1/responses",
"/v1/messages"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"computer-use-preview": {
"deprecation_date": "2026-07-23",
"input_cost_per_token": 3e-06,
Expand Down
18 changes: 18 additions & 0 deletions litellm/provider_endpoints_support_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,24 @@
"interactions": true
}
},
"coralbricks": {
"display_name": "CoralBricks (`coralbricks`)",
"url": "https://docs.litellm.ai/docs/providers/coralbricks",
"endpoints": {
"chat_completions": true,
"messages": true,
"responses": true,
"embeddings": false,
"image_generations": false,
"audio_transcriptions": false,
"audio_speech": false,
"moderations": false,
"batches": false,
"rerank": false,
"a2a": false,
"interactions": false
}
},
"cortecs": {
"display_name": "Cortecs (`cortecs`)",
"url": "https://docs.litellm.ai/docs/providers/cortecs",
Expand Down
28 changes: 28 additions & 0 deletions litellm/proxy/public_endpoints/provider_create_fields.json
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,34 @@
],
"default_model_placeholder": "gpt-3.5-turbo"
},
{
"provider": "CORALBRICKS",
"provider_display_name": "CoralBricks",
"litellm_provider": "coralbricks",
"credential_fields": [
{
"key": "api_base",
"label": "API Base",
"placeholder": "https://inference.coralbricks.ai/v1",
"tooltip": null,
"required": false,
"field_type": "text",
"options": null,
"default_value": null
},
{
"key": "api_key",
"label": "API Key",
"placeholder": null,
"tooltip": null,
"required": true,
"field_type": "password",
"options": null,
"default_value": null
}
],
"default_model_placeholder": "coralbricks/glm-5.3-fp4"
},
{
"provider": "CORTECS",
"provider_display_name": "Cortecs",
Expand Down
1 change: 1 addition & 0 deletions litellm/types/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4263,6 +4263,7 @@ class LlmProviders(str, Enum):
LIBERTAI = "libertai"
PINSTRIPES = "pinstripes"
COGNITION = "cognition"
CORALBRICKS = "coralbricks"
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
CORTECS = "cortecs"
SCX_AI = "scx-ai"
PRISM = "prism"
Expand Down
46 changes: 46 additions & 0 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -16429,6 +16429,52 @@
"supports_function_calling": true,
"supports_tool_choice": true
},
"coralbricks/glm-5.3-fp4": {
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
"cache_creation_input_token_cost": 1.68e-06,
"cache_read_input_token_cost": 0.0,
"input_cost_per_token": 1.12e-06,
"litellm_provider": "coralbricks",
"max_input_tokens": 1048576,
"max_tokens": 1048576,
"mode": "chat",
"output_cost_per_token": 4.4e-06,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Reasoning-heavy calls inflate CoralBricks spend

When reasoning tokens exceed completion tokens, coralbricks bills every reasoning token at the new output rate. generic_cost_per_token adds that count without limiting it to reported output. Non-streaming spend and budget deductions exceed the vendor's cost

Learn more

CoralBricks can return a chat usage block where completion_tokens_details.reasoning_tokens exceeds completion_tokens. The new pricing rows send that usage through generic_cost_per_token, which bills the whole reasoning count separately at the output rate even when it exceeds the output total. The same calculation feeds the response-cost header and spend logs. Streaming usage follows a different normalization path, so identical requests can have different bills.

Example: A response reporting 10 completion tokens and 12 reasoning tokens bills 12 output tokens, rather than the vendor's 10, even before any text tokens are counted

Recommended fix: Normalize CoralBricks reasoning details against completion_tokens before pricing non-stream responses, without changing other providers' accounting. Add a regression with reasoning tokens greater than completion tokens and compare the billed amount to the vendor cost

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CoralBricks nests reasoning inside its output count (35 of 39 tokens in the proof). The arithmetic is the shared calculator every OpenAI-style provider uses

"source": "https://www.coralbricks.ai/pricing",
"supported_endpoints": [
"/v1/chat/completions",
"/v1/responses",
"/v1/messages"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": false
},
"coralbricks/deepseek-v4.1-flash-fast-fp4": {
"cache_creation_input_token_cost": 9e-08,
"cache_read_input_token_cost": 0.0,
"input_cost_per_token": 3e-07,
"litellm_provider": "coralbricks",
"max_input_tokens": 1048576,
"max_tokens": 1048576,
"mode": "chat",
"output_cost_per_token": 1.2e-06,
"source": "https://www.coralbricks.ai/pricing",
"supported_endpoints": [
"/v1/chat/completions",
"/v1/responses",
"/v1/messages"
],
"supports_function_calling": true,
"supports_native_streaming": true,
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_system_messages": true,
"supports_tool_choice": true,
"supports_vision": true
},
"computer-use-preview": {
"deprecation_date": "2026-07-23",
"input_cost_per_token": 3e-06,
Expand Down
18 changes: 18 additions & 0 deletions provider_endpoints_support.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,24 @@
"interactions": true
}
},
"coralbricks": {
"display_name": "CoralBricks (`coralbricks`)",
"url": "https://docs.litellm.ai/docs/providers/coralbricks",
"endpoints": {
"chat_completions": true,
"messages": true,
"responses": true,
"embeddings": false,
"image_generations": false,
"audio_transcriptions": false,
"audio_speech": false,
"moderations": false,
"batches": false,
"rerank": false,
"a2a": false,
"interactions": false
}
},
"cortecs": {
"display_name": "Cortecs (`cortecs`)",
"url": "https://docs.litellm.ai/docs/providers/cortecs",
Expand Down
162 changes: 162 additions & 0 deletions tests/e2e/ui/tests/integrationCritical/addModelCoralBricks.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
import { test, expect, APIRequestContext, Page as PlaywrightPage } from "@playwright/test";
import { randomUUID } from "node:crypto";
import { Page } from "../../fixtures/pages";
import { navigateToPage } from "../../helpers/navigation";
import { captureRequestBody } from "../../helpers/roundTrip";

const master = process.env.LITELLM_MASTER_KEY ?? "sk-integration-master";
const headers = { Authorization: `Bearer ${master}` };
const upstream = (process.env.INTEGRATION_UPSTREAM_URL ?? "http://127.0.0.1:8190").replace(/\/+$/, "");
const CORALBRICKS_MODEL = "deepseek-v4.1-flash-fast-fp4";
const UI_KEY = "cb_ui_integration_key";
const UPSTREAM_PROMPT_TOKENS = 20;
const UPSTREAM_COMPLETION_TOKENS = 20;

type DeploymentRow = {
model_name: string;
litellm_params?: { model?: string };
model_info?: { id?: string; input_cost_per_token?: number; output_cost_per_token?: number };
};

type SpendRow = {
request_id: string;
custom_llm_provider: string;
model: string;
model_group: string;
prompt_tokens: number;
completion_tokens: number;
spend: number | string;
};

const optionNamed = (label: string): RegExp =>
new RegExp(`(^|\\s)${label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);

async function loginAsAdmin(page: PlaywrightPage): Promise<void> {
await page.goto("/ui/login");
await page.getByPlaceholder("Enter your username").fill("admin");
await page.getByPlaceholder("Enter your password").fill(master);
await page.getByRole("button", { name: "Login", exact: true }).click();
await expect(page).toHaveURL(
(url) => url.pathname.startsWith("/ui") && !url.pathname.includes("login"),
);
}

async function selectProvider(page: PlaywrightPage, providerName: string): Promise<void> {
const providerDropdown = page.getByRole("combobox", { name: "Provider", exact: true });
await providerDropdown.click();
await providerDropdown.fill(providerName);
await page.getByRole("option", { name: optionNamed(providerName) }).click();
await expect(providerDropdown).toHaveValue(providerName);
}

async function deploymentNamed(
request: APIRequestContext,
modelName: string,
): Promise<DeploymentRow | undefined> {
const response = await request.get("/v2/model/info", { headers });
expect(response.ok(), await response.text()).toBe(true);
const rows = (await response.json()).data as DeploymentRow[];
return rows.find((row) => row.model_name === modelName);
}

async function deleteDeployment(request: APIRequestContext, modelName: string): Promise<void> {
const stored = await deploymentNamed(request, modelName);
const id = stored?.model_info?.id;
if (!id) return;
const deleted = await request.post("/model/delete", { headers, data: { id } });
expect(deleted.ok(), await deleted.text()).toBe(true);
}

async function chatOnce(request: APIRequestContext, modelName: string): Promise<{ status: number; body: string }> {
const response = await request.post("/v1/chat/completions", {
headers,
data: { model: modelName, messages: [{ role: "user", content: `hello from ${modelName}` }] },
});
return { status: response.status(), body: await response.text() };
}

async function spendRow(request: APIRequestContext, requestId: string): Promise<SpendRow | undefined> {
const response = await request.get(`/spend/logs?request_id=${encodeURIComponent(requestId)}`, { headers });
expect(response.ok(), await response.text()).toBe(true);
const rows = (await response.json()) as SpendRow[];
return rows[0];
}

test("the Add Model form offers CoralBricks and the deployment it creates serves and bills a chat", async ({
page,
request,
}) => {
const alias = `integration-ui-coralbricks-${randomUUID().replace(/-/g, "").slice(0, 12)}`;
try {
await loginAsAdmin(page);
await navigateToPage(page, Page.Models);
await page.getByRole("tab", { name: "Add Model" }).click();

await selectProvider(page, "CoralBricks");

await page.getByRole("combobox", { name: "Select models" }).click();
await page.getByRole("option", { name: "Custom Model Name (Enter below)" }).click();
await page.keyboard.press("Escape");
await page.getByPlaceholder("Enter custom model name").fill(CORALBRICKS_MODEL);

const publicName = page.getByRole("row").filter({ hasText: CORALBRICKS_MODEL }).getByRole("textbox");
await expect(publicName).toHaveValue(CORALBRICKS_MODEL);
await publicName.fill(alias);

await page.locator("#api_base").fill(`${upstream}/v1`);
await page.locator("#api_key").fill(UI_KEY);

const created = await captureRequestBody(page, { method: "POST", urlIncludes: "/model/new" }, async () => {
await page.getByTestId("add-model-btn").click();
});
expect(created.model_name, "the public name typed into the mapping row").toBe(alias);
expect(created.litellm_params?.model, "the custom model name typed into the form").toBe(CORALBRICKS_MODEL);
expect(created.litellm_params?.custom_llm_provider, "the provider the picker maps CoralBricks to").toBe(
"coralbricks",
);
expect(created.litellm_params?.api_base).toBe(`${upstream}/v1`);
expect(created.litellm_params?.api_key).toBe(UI_KEY);
await expect(page.getByText("created successfully")).toBeVisible({ timeout: 15_000 });

let served = { status: 0, body: "" };
await expect
.poll(
async () => {
served = await chatOnce(request, alias);
return served.status;
},
{ message: `the deployment added through the UI never served a chat: ${served.body}`, timeout: 60_000 },
)
.toBe(200);
const requestId = JSON.parse(served.body).id as string;
expect(requestId, served.body).toBeTruthy();

const stored = await deploymentNamed(request, alias);
const inputRate = stored?.model_info?.input_cost_per_token;
const outputRate = stored?.model_info?.output_cost_per_token;
expect(inputRate, JSON.stringify(stored)).toBeGreaterThan(0);
expect(Number.isFinite(inputRate)).toBe(true);
expect(outputRate, JSON.stringify(stored)).toBeGreaterThan(0);
expect(Number.isFinite(outputRate)).toBe(true);
const expectedSpend = UPSTREAM_PROMPT_TOKENS * inputRate! + UPSTREAM_COMPLETION_TOKENS * outputRate!;

let row: SpendRow | undefined;
await expect
.poll(
async () => {
row = await spendRow(request, requestId);
return row?.request_id;
},
{ message: `no spend row for ${requestId}`, timeout: 60_000 },
)
.toBe(requestId);
expect(row?.custom_llm_provider, JSON.stringify(row)).toBe("coralbricks");
expect(row?.model, JSON.stringify(row)).toBe(created.litellm_params.model);
expect(row?.model_group, JSON.stringify(row)).toBe(alias);
expect(row?.prompt_tokens, JSON.stringify(row)).toBe(UPSTREAM_PROMPT_TOKENS);
expect(row?.completion_tokens, JSON.stringify(row)).toBe(UPSTREAM_COMPLETION_TOKENS);
expect(Number(row?.spend), JSON.stringify(row)).toBeCloseTo(expectedSpend, 10);
} finally {
await deleteDeployment(request, alias);
}
});
Loading
Loading