# set_credits_first

URL: https://codepanel.ai/docs/mcp-server/set_credits_first

The CodePanel MCP tool that turns credits-first on, off or back to its default, changing whether credits or your own keys pay for reviewers.

`set_credits_first` turns credits first on or off for your account, or puts it back to the default (on). It decides which key pays for a reviewer: CodePanel credits or your own provider key. It needs the `budget:write` scope, and it takes effect from the next review round.

## When to call it

- **To spend your own keys first:** `enabled: false`, when you want reviews billed to your provider accounts and counted toward your [monthly budget](/docs/budgets-and-limits).
- **To spend credits first:** `enabled: true` or `null`, so starter and purchased credits are used up before your keys.
- **Only when your user asked.** It changes who is billed.

A round never switches keys mid-call. An invalid stored key can still run on credits whatever this is set to, when the deployment has a platform key for that model.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `enabled` | boolean or null | yes |  |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

`enabled` is required: `true`, `false`, or `null` for the default. The server refuses a call without it.

## What it returns

`before` and `after`, each `{ creditsFirst, source }` as in [`get_credits_first`](/docs/mcp-server/get_credits_first). Setting `true` or `false` makes `source` `set`; `null` returns it to `default`.

## Examples

These responses come from a test account on a local backend.

```json title="Call"
{ "enabled": false }
```

```json title="Result"
{
  "after": { "creditsFirst": false, "source": "set" },
  "before": { "creditsFirst": true, "source": "default" }
}
```

Credits-first reviewers now run on your own keys, so their cost counts toward the monthly budget. Restore the default with `{ "enabled": null }`.

## The same step without MCP

| Surface | Form |
| --- | --- |
| CLI | `codepanel credits-first on\|off\|default` ([CLI](/docs/cli)) |
| HTTP API | [`POST /credits-first`](/docs/api#post-credits-first) |

The dashboard switch is **Spend credits before my own keys** in **Settings → Billing**.

## What the server tells your agent

The description your agent reads when it lists the tools:

> Turn credits-first on or off (enabled: true|false), or null for the default (on). Applies from the next review round; a round never switches keys mid-call. Needs the budget:write scope. Returns the setting before and after, as get_credits_first.

## Related

- [`get_credits_first`](/docs/mcp-server/get_credits_first): read it first.
- [`set_budget`](/docs/mcp-server/set_budget): the limit that counts own-key spend.
- [Billing: credits and budgets](/docs/billing#credits-and-budgets): how the two interact.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
