Pay with your own AI gateway
Last updated 18 November 2026
The model-assisted features (the analyzer, activation tests and author evals) call AI models, and your organisation pays for every one of those calls. It pays in one of two ways: through its own AI gateway, or with credits. This guide covers the gateway: an OpenAI-compatible endpoint your organisation runs or buys, such as the proxy your company already uses to reach AI models. Spellwarden sends each call to that endpoint with your key, and your gateway's provider bills you for it. Spellwarden charges nothing for those calls.
The model-assisted features need a paid Team or Enterprise plan. During the 14-day trial an organisation sees the AI models page, the prices and the credit packs, and can connect nothing and start no paid job. To pay with credits instead, see Credits for model-assisted features.
What you need
Three things, all from your gateway: its base URL, a key Spellwarden can use, and the name of the model it should call. Spellwarden checks each of them when you save.
| Field | What Spellwarden accepts |
|---|---|
| Base URL | An https address on port 443, with a host name and, if you need one, a path such as /v1. No user name or password, no query and no fragment, at most 2,000 characters. Every address the host name resolves to must be public: private, loopback and link-local addresses are refused. |
| Key | 16 to 512 printable characters without spaces. It is sent as Authorization: Bearer <key> and in no other header. |
| Model name | The model name your gateway expects, one line of 1 to 128 characters. Spellwarden sends it as it is. |
An organisation has one gateway. To use another one, change the one you have.
Connect the gateway
- In the dashboard, open Settings, then AI models. Owners and managers see Connect gateway.
- Select Connect gateway and fill in the base URL, the key and the model name.
- Select Save gateway. Spellwarden checks the address, stores the key encrypted and runs the connection test at once. The page shows the host, the model, the key's last characters and the test's result.
- If the test passed, choose Use the gateway, so that the organisation's paid jobs are paid through it.
A refused address gets one of these messages, word for word:
- Use an https address on port 443 without a user name, a query or a fragment, at most 2,000 characters.
- This address is not public. Spellwarden calls public https addresses only.
- Spellwarden could not find this address. Check the spelling and try again.
The connection test
The test makes one short call through your gateway: Spellwarden's fixed instruction "You are a connection test.", the request "Call the function record_judgement with ok set to true.", the function record_judgement with one boolean field ok, and an answer of at most 64 tokens. It waits 5 seconds to connect and 20 seconds in all, so the page always gets a result. It costs your organisation one short call at its gateway. The text of the reply is never stored, shown or logged.
A test passes when the gateway answers in the OpenAI chat completions shape. It also records whether the model called the function: author evals need a model that can call functions, because their grader answers that way. When it did not, the page says: This model did not call the test function, so author evals cannot use this gateway.
| Code | What happened |
|---|---|
unreachable | Spellwarden could not connect to the address. |
timeout | No complete answer within 20 seconds. |
key_refused | The gateway answered 401 or 403: check the key. |
model_not_found | The gateway answered 404: check the model name and the base URL's path. |
refused | The gateway answered with another 4xx status. |
unavailable | The gateway answered with a 5xx status. |
not_openai | The answer was not in the OpenAI chat completions shape. |
redirect | The gateway answered with a redirect. Spellwarden follows no redirect: use the final address. |
private_address | The host name now resolves to an address that is not public. |
Select Test connection to run it again. An organisation can run 10 tests an hour, the test on connect included, and connect, change or remove its gateway 20 times an hour.
Choose how the organisation pays
Settings, AI models shows the way the organisation pays: Pay with your AI gateway, or Pay with credits. A new organisation pays with credits. Owners and managers switch with Use the gateway or Use credits; the gateway way needs a connection whose last test passed. The choice applies to every paid job the organisation starts, by any member.
Before a job starts, its dialog says how it is paid. For a gateway job it reads, for example: Calls go to your gateway, model claude-sonnet-5.5. When the gateway is the way to pay but no connection exists or its last test failed, the job does not start and says: Connect your AI gateway and pass its connection test, or pay with credits.
Gateway jobs are not counted against the monthly credit limit, because their cost is your gateway's and Spellwarden does not know it. They are bounded by each feature's own monthly and running caps, which the guides of the analyzer, activation checks and author evals state.
What is sent to your gateway
- For the analyzer: the skill's SKILL.md and its scripts, as stored with the skill's last scan.
- For an activation test: the skill's name and description, the names and descriptions of the public skills it is listed with, and the test prompts generated from the description.
- For an author eval: the skill's package, and the tasks of the practice suite or the tasks the author supplied, with the answers a grader reads.
- Spellwarden's own fixed instructions for each kind of job.
Only your organisation's own content and public content are sent. Text that looks like a credential is masked before anything is sent, as it is for evals. Sealed eval suites never go to a gateway: Spellwarden refuses a sealed suite on the gateway path by design, and the existing eval runs keep using AI models on Amazon Bedrock.
Each call is one request in the OpenAI chat completions shape:
POST <base URL>/chat/completions
Authorization: Bearer <your key>
Content-Type: application/json
Accept: application/json
{
"model": "<the model name you saved>",
"messages": [
{"role": "system", "content": "<Spellwarden's fixed instructions>"},
{"role": "user", "content": "<the masked content of the job>"}
],
"max_tokens": <the job's output cap>,
"stream": false,
"tools": [{"type": "function", "function": {"name": "record_judgement", "description": "...", "parameters": {...}}}],
"tool_choice": "auto"
}The function and "tool_choice": "auto" are sent only when a job's grader needs them; the analyzer and the activation test ask for a JSON answer in the text instead. Spellwarden calls https addresses on port 443 only, follows no redirect, uses no proxy and refuses an answer over 1 MiB. A job's call waits 10 seconds to connect, 120 seconds for the answer and 130 seconds in all. The answer's token counts are what the job records; an answer without them is counted at the call's upper bound.
Your gateway acts for your organisation, not for Spellwarden: what it does with the content is between your organisation and its provider. The privacy policy states what Spellwarden keeps and for how long.
When a call fails
A busy gateway (429), a server error (5xx), a timeout or a lost connection is retried, as calls to Amazon Bedrock are. A gateway that refuses the request, or answers in a form Spellwarden cannot read, ends the job at once, and nothing is judged from its answer. A job that ends in an error is charged nothing by Spellwarden; your gateway's provider may bill the calls it answered. The job's page shows one of these sentences:
| Code | What the job page says |
|---|---|
gateway_unavailable | Your AI gateway did not answer in time, even after retries. Try again later. |
gateway_refused | Your AI gateway refused the request. Check its key, model name and address in Settings, AI models. |
gateway_changed | The AI gateway was changed or removed while this job ran. Start it again. |
gateway_answer_invalid | Your AI gateway answered in a form Spellwarden cannot read, so nothing was judged from it. |
An author eval on a gateway whose model did not call the test function does not start and says: Author evals need a gateway model that can call functions. Test the connection with such a model, or pay with credits.
Change or remove the gateway
Change gateway lets an owner or manager change the address, the model or the key; empty fields keep what is stored. A new address needs the key again, so that a stored key never goes to a host it was not pasted for: A new address needs its key. Paste the key again. Each change runs the connection test again. A job that was running when the gateway changed ends at its next call with the error gateway_changed.
Remove gateway deletes the stored key. It works at any time, also while the organisation is read-only. Removing the gateway does not switch the organisation to credits: jobs are refused until someone connects a gateway or chooses Use credits, so nothing is ever charged to the credit balance without that choice. When an organisation is deleted, its gateway and the stored key are deleted with it.
How the key is kept
The key is encrypted with a key held in AWS Key Management Service and used only to call your gateway. After it is saved it is never shown again: the page shows only its last four characters, the key field of Change gateway stays empty, and no route, export, log line, audit entry or alert holds it. An answer from your gateway that repeats the key is refused as gateway_answer_invalid and nothing of it is kept. The audit log records each connect, change and removal with the host, the model and the key's last characters, never the key or the address's path.
Who can do what
| Role | What they can do |
|---|---|
| Owner and manager | Connect, test, change and remove the gateway, choose how the organisation pays, and start paid jobs. |
| Member | See the settings and start paid jobs, which go through the gateway when it is the way to pay. |
| Viewer and billing | See the settings. They start no paid job and change nothing here. |
Paid jobs start from the dashboard, and the analyzer also after a scan when an owner or manager turned it on: no API key, connected app or MCP tool can start one.