Moving inference to Amazon Bedrock
Status: steps 1–4 are built. Bedrock in svc-ai sits behind INFERENCE_BACKEND (default direct), and the dev deployment switched on 8 October 2026. Titan embeddings and the rebuild (step 4, section 4) were built on 9 October 2026 and wait for the operator steps in that section. Steps 5 and 6 are planned. Decisions were taken on 8 October 2026. The facts below were checked against AWS, Anthropic and OpenAI documentation on 8 October 2026. Re-check them before building, because Bedrock's model list changes monthly.
Why
Operators manage cost in many places: AWS for infrastructure, and separate accounts and keys for OpenAI, Anthropic and Brave. Inference is also the one cost with no natural limit. Moving model calls to Bedrock:
puts them on the AWS bill;
lets the platform choose where inference runs;
leaves one place to cap spend.
Decisions (8 October 2026)
| Question | Decision |
|---|---|
| Direct OpenAI and Anthropic APIs | Bedrock only in deployed environments. The direct clients stay in the code for local development without AWS. |
| Embeddings | Titan Text Embeddings V2, in London, with a one-off re-index. |
| Spending ceiling (dev) | $15 a day, $150 a month, covering all model spend, the benchmark included. |
What Bedrock offers (checked 8 October 2026)
Claude:
In London only (
bedrock-runtime, eu-west-2): Sonnet 4.6, Opus 4.6, Sonnet 5 and Opus 5.5.Through the EU cross-region profile (
eu.): Haiku 4.5 and 5.5, Sonnet 4.5 and 5.5, Opus 4.5, 4.7, 4.8 and 5. From London,eu.routes to Frankfurt, Stockholm, Milan, Spain, Ireland, London and Paris.Global only: Fable 5 and 5.1.
Price: Global costs the same as Anthropic direct; EU or in-region London costs 10% more. Bedrock offers no batch, Flex or Priority discount for current Claude models.
OpenAI:
Proprietary GPT-5.4 to GPT-6.1 are on Bedrock. From Europe, GPT-5.6 and later are reachable only through
global., so data can leave Europe. GPT-5.4 and 5.5 are not reachable from Europe at all.The open-weight gpt-oss-20b and gpt-oss-120b run in London.
No GPT-4o or 4.1 models, and no OpenAI embeddings.
Features:
Tools, streaming, effort and prompt caching (
cachePoint, 5-minute or 1-hour TTL) are all available.Native structured output (constrained decoding) only for Claude ≤ 4.6 (Haiku 4.5, Sonnet 4.5 and 4.6, Opus 4.5 and 4.6), GPT-5.6+ on non-streaming calls, gpt-oss and Qwen3 235B 2507. Claude 4.7 and later run on
structured_call's function-calling fallback. Structured calls are sent whole, never streamed (19 October 2026,structured_output._unstreamed).Some Claude models refuse a forced
tool_choicewhile thinking is on, and Claude 5.x thinks by default. The fallback forces the schema tool only where the route says it may (forced_tool_choice: Claude 4.5 and 4.6) and otherwise offers it with an instruction to call it (19 October 2026). Before, langchain-aws forced it on every Claude 5.x route.
Retention: by default Bedrock keeps no prompts or answers, and its operators cannot access them. Model providers never receive them. The exceptions are models AWS keeps traffic for, stored in the Region that processed it (Bedrock user guide, "Abuse detection" and "Data retention"):
Claude Fable 5 and 5.1: all traffic, up to 30 days, with possible human review by AWS. They run only once the account opts in to the
aws_reviewretention mode.GPT-5.4 and later: traffic AWS's classifiers flag, up to 30 days.
Embeddings in London: Titan V2 (1024 dimensions, $0.10 per million tokens there, about five times OpenAI's price) or Cohere v3 (in-region). Cohere v4 is available only through the EU or Global profiles.
No native hard spend cap:
AWS Budgets data lags 8–24 hours.
The new account "spend limits" pause the whole account, EC2 included.
Service quotas limit rate, not spend.
Provisioned and Reserved throughput fix a cost but overflow to on-demand.
Claude is billed through AWS Marketplace, so a budget filtered to "Amazon Bedrock" misses it.
Credentials:
Long-term Bedrock API keys are IAM-user keys, which the SCPs rightly forbid.
Short-term keys and role credentials last at most 12 hours.
Containers cannot reach the instance role (metadata hop limit 1, pinned by
tools/security/test_edge_config.py), and that stays.
Brave Search is sold through AWS Marketplace ($5 per 1,000 requests), so it can bill on the AWS invoice with no code change. AWS's own search tools are US-only.
Private connectivity: a
bedrock-runtimeinterface endpoint costs about $8 a month in eu-west-2, plus $0.01 per GB.
The design
1. The spending ceiling (built)
svc-ai refuses a model call before it is sent once the day's or month's spend reaches its ceiling. It counts every call, the benchmark included, and calls it cannot price count at the dearest catalogue rate. The benchmark keeps to half of each ceiling. See docs/guides/cost-monitoring.md#the-spending-ceiling. This is the primary control and does not depend on the provider.
2. Bedrock in svc-ai (built)
A route, not a new model. A catalogue model keeps its identity ("Claude Sonnet 5", anthropic/claude-sonnet-5) and its UUID on either backend. Agents, rules, evaluation variants, dashboard tiles, node pins, TRIAGE_MODEL and the judge all refer to it unchanged. INFERENCE_BACKEND decides how it is reached (app/services/inference_routes.py):
resolve(provider, model)returns the route, or refuses a model with no route on this backend (RouteUnavailable, a fatal model error: "This model is not available on Amazon Bedrock…").A call is still metered and priced as the catalogue model.
What the seeder does on each start (
providers/seeder.py):Writes each model's route figures: on Bedrock, the route's prices,
data_regionand limits.Sets
is_available: false for a model with no route on this backend. fe-core's pickers and svc-core's routing, benchmark and agent defaults already read only available models.Moves the default model when the backend changes: on Bedrock to the seed marked
is_default_on_bedrock, and back to the direct default otherwise. The seededbedrockprovider row records the backend it last ran under.
data_regionis now persisted by value. It was persisted by enum name, soglobal(global_) would have been refused, and svc-ai would have failed to start.
Built in this step:
Provider. A
bedrockprovider (svc-ai migration 25).Chat models through langchain-aws
ChatBedrockConverse.Direct calls through LiteLLM's
bedrock/converse/….Model ids are Bedrock ids or inference-profile ids (
eu.anthropic.…,global.openai.…).Usage comes from Converse's
inputTokens,cacheReadInputTokens,cacheWriteInputTokensandcacheDetails.
Catalogue. Seeded Bedrock models with their true
data_region(uk,euorglobal). This closes Known gap 16, so a UK/EU residency rule finally acts.Price cards carry Bedrock's rates, including the 10% regional uplift. LiteLLM prices bare in-region ids at the Global rate and has no London Titan price, so the catalogue must carry its own.
Capabilities (
model_capabilities.capabilities_for) are per route. On Bedrock, the vendor's temperature and effort rules hold. There is no Responses API, and the output cap ismax_tokens. Native structured output is the route's own flag.Structured outputs (AWS guide, checked 8 October 2026). Converse decodes a reply to a JSON Schema sent as
outputConfig.textFormat, for the models whose card lists it.Which models. Of the routed models: Sonnet 4.6, Opus 4.6, Haiku 4.5, gpt-oss-120b and Qwen3 235B (cards rechecked 19 October 2026). The Claude 5.x cards list structured outputs as not supported, so Haiku 5.5, Sonnet 5 and Opus 5 use
structured_call's function-calling fallback, with the schema tool offered rather than forced. Amazon Nova Pro's card lists them as not supported either.structured_callbinds the sameresponse_formatas for the vendors, and langchain-aws turns it intooutputConfig. Bedrock refuses a schema outside its JSON Schema subset with a 400. A test (test_the_strict_schema_is_inside_bedrocks_subset) holds every model-facing schema inside that subset.Direct calls (
llm.run_model/stream_model) send a JSON Schemaoutput_schemaasoutputConfigon a native route (app/services/bedrock_schema.py). LiteLLM passes the field into the request unchanged, pinned offline against its own request building. Since 20 October 2026 svc-core's judge, optimiser proposer, dashboard generator and comparison tile ask this way with the strict schema of aModelOutput(structured_reply), so on a native route their replies are decoded to it. On the vendors' APIs (thedirectbackend) the same schema goes as a strictjson_schemaresponse_format; never through LiteLLM on Bedrock, whose own model map would choose the method.Keywords outside the subset (bounds, lengths, other formats) are left out of the wire schema. They stay in the instruction, and the caller validates the reply against the whole schema.
A prose
output_schemais left to the instruction.If Bedrock refuses the schema, the call is made once more without it. The refusal comes before any token, so a stream repeats nothing.
The first call with a new schema is slow. Bedrock compiles each new schema into a grammar, which "may take up to a few minutes", and caches it for 24 hours per account. A route that decodes natively therefore gets the 300-second timeout.
Claude 5.x decodes no schema here, so it may lend its structured steps to a sibling (built and switched off, 20 October 2026,
NATIVE_STRUCTURED_SIBLING=false;docs/guides/agent-graph.md#a-native-sibling-20-october-2026-off).What it does when on. svc-core names, per turn, the same maker's model in the same region that does decode natively (svc-ai's catalogue
decodes_natively), nearest in tier then cheapest, never one a rule in force names; none when a person chose the model. svc-ai checks it again and has it make each structured system step whose own model would fall back to function calling: triage, recon, planning, retrieval's query planner and judge, the quality check, memory extraction, a router's choice, an output repair. Answers, synthesis and a skill node's own typed output stay on their models. A sibling that cannot be built or is refused outright is given up for the run.Why it is off. On today's catalogue: Haiku 5.5 and Opus 5 (EU) can drop only to Haiku 4.5, about ten times Haiku 5.5's price per token, whose Bedrock end of life may now come at any time (listed as no sooner than 16 October 2026); Sonnet 5 (London) drops to Sonnet 4.6. It is unmeasured, and the account has no Anthropic access yet. Turn it on only after a benchmark run with it holds, and while Haiku 4.5 is still served.
Strict tool use (
strict: trueon a tool definition) is on for gpt-oss-120b and Qwen3 235B since 20 October 2026, and for DeepSeek V3.2, Kimi K2.5 and Ministral 3 14B since 31 October, after the probe measured it (app/tools/wire.py,STRICT_BUILTIN_TOOLS=true).What it does. On a route whose
strict_toolsflag is set (gpt-oss-120b and Qwen3 235B; see the probe below), every tool whose schema the platform wrote — the built-ins, the knowledge tools, a scripted tool standing in for one — is bound withstrict: trueandstrict_tool_schemaof its arguments: optional arguments stay optional, and bounds Bedrock refuses are stated in the description. langchain-aws carries the flag totoolSpec.strict. Onlyrender_chart(free-form rows) andrender_map(GeoJSON) cannot be expressed (wire.NOT_STRICT).What it never touches. Webhook tools (a free-form payload), a scripted tool standing in for none, MCP tools, any vendor's API (OpenAI's strict mode requires every argument), Claude 5.x on Bedrock. The tool still runs as before, and its pydantic arguments still enforce every bound.
A refusal (
model_errors.refused_schema) is retried with the tools as they are, and the route is never sent strict tools again (provider_refusals).Why it waited, and the probe. Each agent has its own tool set (its knowledge tools), so each set might compile a grammar on its first turn ("may take up to a few minutes", AWS), and again after any 24 hours without a call.
app.diagnostics.structured_probemeasures it, by hand with approval (cents). As ec2-user in~/chainr/modules:docker compose -f docker-compose.yml -f docker-compose.prod.yml -f docker-compose.ecr.yml exec -T svc-ai python -m app.diagnostics.structured_probe | grep '^{"route"'. A route was to get the flag only if a strict typical set and a reply schema with tools are accepted, a new typical set costs about ten seconds or less over a cached one, and a reordered set or one more tool does not recompile.STRICT_BUILTIN_TOOLSis in/health's fingerprint, so turning it on re-runs CHAINR Bot's benchmark once.What it found (20 October 2026; 34 calls, under a cent). The six Claude routes were skipped: the account has no Anthropic access.
Case gpt-oss-120b Qwen3 235B B: a reply schema, streamed Accepted, but the reply did not read as JSON Valid JSON C, D, G: strict tools: one, a typical set (new, again, reordered, one more, one fewer), an optional argument left out All accepted; 0.4–0.6 s whatever changed All accepted; 0.5–0.9 s; the optional argument left out E: a reply schema and strict tools together Accepted; unstreamed it did not call the tool; streamed, the answer after the tool round was not JSON Accepted; it did not call the tool F: a forced tool call, not strict Accepted and ignored: it answered without the tool Accepted, and it called the tool What was decided.
strict_toolsis set on gpt-oss-120b and Qwen3 235B, and cleared on Claude Haiku 4.5, Sonnet 4.6 and Opus 4.6 until a run measures them;STRICT_BUILTIN_TOOLSis on.Acceptance shows Bedrock does not refuse strict tools; it cannot show it enforces them, since an argument this simple is valid either way, and no compile cost at all fits both readings. The tools' pydantic arguments still check every call.
forced_tool_choicestays off for both: gpt-oss ignores a forced choice, and one forced call from Qwen cannot say it was forced (it left the tool alone in three of D's calls). Function calling is only their fallback anyway.A reply schema stays out of the tool loop: neither route answered a tool round in the schema (E). A run's answer is shaped after it ends instead (
app/inference/output_shape.py).gpt-oss's streamed reply schema not reading as JSON (B, E) touches no structured step:
structured_callnever streams, and svc-core's judge, optimiser, dashboard generator and comparison tile use svc-ai's batch endpoint. The one streamed case is a model chat with JSON output chosen on gpt-oss. The cause is unconfirmed; gpt-oss writing its analysis as text in a stream, asreply_probehas seen before, would explain it.Run it again when Anthropic access arrives, and set the Claude routes' flags from that run.
Prompt caching for Claude on Bedrock appends an explicit
{"cachePoint": …}block after the system text. langchain-aws passes it through, and would drop an Anthropiccache_control. A Bedrock client is never sentprompt_cache_key, which Converse would refuse.Usage needs no new parser. langchain-aws reports total input including cache reads and writes, with the 5-minute and 1-hour write split, which is what
provider_usageprices.Errors. botocore errors are classified like the SDKs' (
model_errors):AccessDeniedException→ permission;bad or expired credentials, or none at all → auth;
ResourceNotFoundException, or aValidationExceptionnaming an invalid model identifier → model not found;ServiceQuotaExceededException→ quota.Throttling and other 400s degrade. botocore retries transient failures (
standardmode,MODEL_CALL_RETRIES).A refused native schema is a 400.
structured_callfalls back to function calling for that call, and for the life of the process only when the 400 names the schema (model_errors.refused_schema,provider_refusals); a 400 about the prompt switches nothing off. A direct call is made once more without it.LiteLLM's own
num_retriessent any failed request three times, a 400 included. Aretry_policy(llm._RETRY_POLICY) now leaves 400s, content-policy refusals and rejected keys alone, on the vendors' APIs and Bedrock alike.Only the error code is ever described, never the message, which can name the account and role.
On the batch API and embeddings, a fatal error is a 502 with the message and its
code(no route here, no model access, credentials, quota, the spending ceiling). It had been a 500 carrying the exception's text, becauseexecute_and_persistcaught it beforemain.py's handler. svc-core shows the message on a direct prompt (ModelRefusedError), not "Model unavailable.".
The benchmark stamps each result with the backend it ran on (svc-ai's
/healthbackend). A model's results from the vendor's API do not stand for the same model on Bedrock, and the backend is part of CHAINR Bot's fingerprint.The catalogue on Bedrock (
providers/registry.py, each route'sbedrockentry). IDs, prices and behaviour were checked on 8 October 2026 against the AWS model cards, the London Price List API and Anthropic's model and pricing pages. Tests hold every UK or EU price at exactly 10% above the vendor's list price and Global at the list price, and each route's region to the prefix of its ID:Model Route Converse model ID $ / MTok in, out Native structured output Claude Opus 4.6 UK anthropic.claude-opus-4-6-v15.50, 27.50 yes Claude Sonnet 5 UK anthropic.claude-sonnet-52.20, 11.00 no Claude Haiku 4.5 EU eu.anthropic.claude-haiku-4-5-20251001-v1:01.10, 5.50 yes Claude Opus 5 EU eu.anthropic.claude-opus-55.50, 27.50 no Claude Haiku 5.5 (default) EU eu.anthropic.claude-haiku-5-50.11, 0.55; five times over 100K prompt tokens no Qwen3 235B (fallback default) UK qwen.qwen3-235b-a22b-2507-v1:00.34, 1.37; no prompt caching yes gpt-oss-120b UK openai.gpt-oss-120b-1:00.23, 0.93; no prompt caching yes DeepSeek V3.2 UK deepseek.v3.20.961, 2.8675; 8K max output; strict tools yes Kimi K2.5 UK moonshotai.kimi-k2.50.93, 4.65; strict tools yes Ministral 3 14B UK mistral.ministral-3-14b-instruct0.31, 0.31; 8K max output; strict tools yes Nova Pro UK amazon.nova-pro-v1:01.13, 4.52 no Nova Lite UK amazon.nova-lite-v1:00.084, 0.336 no Nova Micro UK amazon.nova-micro-v1:00.049, 0.196 no Nemotron 3 Super 120B UK nvidia.nemotron-super-3-120b0.23, 1.01; 32K max output; probe pending yes Nemotron Nano 3 30B UK nvidia.nemotron-nano-3-30b0.09, 0.37; 8K max output; probe pending yes Haiku 4.5's base ID can't be used for on-demand calls on bedrock-runtime, hence its EU profile. Bedrock lists its end of life as no sooner than 16 October 2026.
Claude 5.x on Bedrock thinks by default. Thinking is billed as output. It refuses a non-default temperature (the capability table already omits it) and has no native structured output.
Claude Fable 5.1 is not routed (decided 8 October 2026). It is Global-only from London (
global.anthropic.claude-fable-5-1, at the list price), and it runs only under the account'saws_reviewretention mode. Every route is zero-retention in the UK or EU, andtest_no_route_goes_to_a_model_aws_keeps_prompts_forkeeps it so. If it is ever routed, note that it refuses a forced tool choice; langchain-aws sendsautofor it.The 64K output cap is Bedrock's, not Anthropic's: on its own API, Sonnet 4.6 allows 128K.
What is not routed yet.
GPT-5.6 Sol, Terra, Luna and GPT-6 Astra. From London they are reachable only as
global.openai.gpt-…(Global routing), at OpenAI's list prices. AWS documents their tool calling through the Responses API, not Converse, and Converse reports no reasoning or cache fields for them. langchain-aws assumes Converse tool use works, but nobody has confirmed it. On a Bedrock deployment they are unavailable. Routing one now also needs:the SCP to allow Global profiles;
an exception to the zero-retention rule, since AWS keeps their flagged traffic for 30 days;
one live call with a tool succeeding.
Each would then be a route entry:
Model Model ID $ / MTok in, out Cache read 30-minute cache write GPT-5.6 Terra global.openai.gpt-5.6-terra2, 12 0.20 2.50 GPT-5.6 Sol global.openai.gpt-5.6-sol4, 20 0.40 5 GPT-6 Astra global.openai.gpt-6-astra10, 50 1 12.50 All four double their rates over 272K prompt tokens.
GPT-4o and GPT-4o Mini are not on Bedrock.
gpt-oss-120b (London, $0.23 / $0.93, native structured output) was added as an open-weight stand-in (below), although Converse tool use for it is not documented either.
Model access (
BEDROCK_MODEL_ACCESS, added 8 October 2026). The first switch hitAccessDeniedException: … not available for this account … contact AWS Saleson every Claude model: AWS grants Anthropic access per account.The setting names the vendors the account may use:
all, or a list such asopenai,qwen.A route to any other vendor's model is unavailable (hidden from every picker, skipped by the benchmark) and refused with a reason rather than failing at AWS.
It is an SSM parameter (
ai/BEDROCK_MODEL_ACCESS). Setting it back toallonce Anthropic access is granted restores the Claude routes, the default and the judge on the next deploy.
Open-weight stand-ins (researched 8 October 2026). They are London in-region, billed by AWS (no AWS Marketplace, no use-case form) and absent from AWS's retention list. No non-Anthropic EU profile accepts calls from London.
Qwen3 235B is the fallback default. It is stronger than Amazon Nova Lite (Artificial Analysis index 12 against 7), has native structured output, and writes no
<thinking>text into answers, which Nova does when tools are bound.gpt-oss-120b is the second benchmark judge (
PLATFORM_BENCHMARK_JUDGEis now a preference list): another vendor than the default, so CHAINR Bot never grades itself.Neither has documented streamed tool use. gpt-oss had garbled streamed tool calls reported in April 2026. Judge calls are not streamed, but an agent on either should be checked with one ConverseStream call with tools before relying on it.
Amazon Nova Lite was left out at first, because its tool-mode
<thinking>text would reach the chat. svc-ai'sinline_tagsreply format now strips it, and Nova was added on 30 October 2026 (below).
The other makers (added 30 October 2026, the user's request). The aim was each main Bedrock maker's best London model, and a faster one where the maker has one worth choosing. All are London in-region (no EU profile for them accepts calls from London, and none is Global). Prices come from the AWS Price List for eu-west-2, published 2026-10-30; the pricing page lists no London price for several of them. AWS keeps traffic only for OpenAI's non-open-weight models and Claude Fable (its abuse-detection page, checked 2026-10-30), so all are zero-retention.
Which models (after the probes of 31 October 2026, below):
DeepSeek: V3.2.
Moonshot: Kimi K2.5. Moonshot's card says it thinks by default, on Moonshot's own API; on Bedrock it returned no reasoning (below), so its route declares none (
reasons_before_answering).Mistral: Ministral 3 14B.
Amazon: Nova Pro, Lite and Micro.
NVIDIA (added 31 October 2026): Nemotron 3 Super 120B and Nemotron Nano 3 30B, unprobed. NVIDIA serves both reasoning by default; how Bedrock returns that, and whether its tool calls work over Converse (the cards list tool calling only on the other endpoint), wait for the probes.
How they decode and call tools: schemas are decoded natively where the card lists structured outputs (not Nova, which uses function calling). Tools are held strict on DeepSeek, Kimi and Ministral, which the probe measured; no tool call is forced.
Every one is
light: the bands are cost-ordered across the catalogue, and the dearest of them (Nova Pro, $1.13) is below the cheapest balanced model.The probes (31 October 2026, on the dev host, under a dollar):
The structured probe:
Route Result Kimi K2.5 The same, 0.4–0.8 s. A reply schema with tools once ran to the probe's 1,024-token cap. Ministral 3 14B The same, 0.3–0.6 s. Mistral Large 3 Every call a ValidationExceptionin about 0.03 s, a plain forced tool too. Its card lists London; the region table does not.Gemma 3 27B and 12B Schemas decoded, but no tool was ever called, not even when forced. The card lists tool calling only on the other endpoint. Nova Pro, Lite and Micro Reply schemas and strict tools refused; a plain forced tool call taken. That is how the routes were already set. The reply probe:
Nova (Pro, Lite, Micro) returns its reasoning in tool turns as a
reasoning_contentblock unstreamed, and as<thinking>text streamed;inline_tagsremoves it, and its answers carry none.Kimi K2.5 returned no reasoning, with or without
reasoning_effort: tool calls in 19–30 output tokens, answers clean. A turn replayed with its earlier tool call raised nothing.Ministral 3 14B returned no reasoning and no tags.
DeepSeek writes its own tool-call marker,
<|DSML|function_calls, into a tool turn's text beside the parsed tool call. A reply format of its own,dsml, removes the marker and what follows it. Asked for the news with one scripted search result, it searched again every time rather than answer; the per-tool call limits (app/tools/limits.py) bound that.
Withdrawn (
WITHDRAWN_MODELS; the seeder archives their rows, so nothing can run them):Mistral Large 3: refused every call from London.
Gemma 3 27B and 12B: no tool calls through Converse. With no Google model left,
googleneeds no access.
Not routed, and why:
Kimi K3: US or India Geo and Global profiles only.
Nova 2 Lite: Global only from London.
Every Meta model: Llama 3 70B and 8B are the only Llamas callable from London, and have an 8K window, no tool calling and no structured outputs. Llama 3.3 and 4 run in neither London nor the EU.
Gemma 3 4B: no structured outputs.
Gemma 4: not in London, and not on Converse.
Mistral Large (2402): 32K window, $5.20 / $15.60.
Devstral 2 and the smaller Ministral 3 models: the user's choice.
Every xAI Grok model: Grok 4.6 and 4.7 reach London, and every EU region, only through Global routing; Grok 4.3 runs only in the US (checked 31 October 2026).
Nemotron Nano 9B v2 and 12B v2 VL: Legacy since 30 September 2026, and AWS's lifecycle page says new customers cannot use Legacy models.
Lifecycles to watch. Bedrock lists these end-of-life dates:
DeepSeek V3.2: no sooner than 1 December 2026.
Ministral 3 14B: no sooner than 2 December 2026.
Kimi K2.5: no sooner than 27 January 2027.
Nemotron Nano 3 30B: no sooner than 15 December 2026; Nemotron 3 Super 120B: no sooner than 11 March 2027.
Going live. Each is unavailable until its maker is in
BEDROCK_MODEL_ACCESS: adddeepseek,moonshotaiandmistral, andnvidiaonce its probes pass. Nova sharesamazonwith Titan, so it was live on deploy, on function calling. A new route is probed first, on the host, withBEDROCK_MODEL_ACCESS=allset for the probe process only:python -m app.diagnostics.structured_probe --route bedrock/<id>, for multi-turn tool calls, schemas, strict tools and a forced choice;python -m app.diagnostics.reply_probe --provider bedrock --model <id>, for how reasoning arrives.
The maker is what the platform compares, not the provider (
inference_routes.maker_of, served as the catalogue'smaker). Every model Bedrock alone serves is registered underbedrock, so the lighter model, the native sibling and the benchmark would otherwise treat Nova and DeepSeek as one maker.
The default model is chosen by benchmark, not by price alone.
The fallback default (
is_fallback_default_on_bedrock, Qwen3 235B) stands in while the Bedrock default is unavailable, and gives way when it returns (seeder_keep_default_usable). An operator's own choice of an available model is left alone.The seeded choice is Claude Haiku 5.5 (EU):
It is the cheapest Claude, EU-resident, and handles tools well.
It runs on the function-calling fallback.
The current direct default, GPT-5.6 Luna, has no Bedrock route.
The platform benchmark scores every Bedrock model on the first Bedrock deploy. If another holds better, changing the default is a catalogue setting.
Changing it re-runs CHAINR Bot's benchmark. Ship it in the same deploy as the gold-dataset review, so the re-baseline is paid once.
3. Credentials and AWS-side controls (built; an operator applies them)
Terraform in infra/terraform/envs/dev (bedrock.tf, cost-controls.tf), the host's credential timer in infra/aws/bedrock, and the SCP in infra/aws/scps. None of it changes what svc-ai does until INFERENCE_BACKEND=bedrock. tools/security/test_bedrock_config.py pins the boundary, tools/test_bedrock_credentials.py and tools/test_bedrock_kill_switch.py run the scripts and the Lambda against stubs, and terraform validate passes. Nothing has been applied to AWS yet.
The role.
chainr-dev-bedrock-invoke, assumable only by the instance role. It is allowedbedrock:InvokeModelandbedrock:InvokeModelWithResponseStream(which also authorise Converse and ConverseStream) on the catalogue's routes and nothing else:the London models directly;
each
eu./global.profile;the model behind each profile, only through that profile (
bedrock:InferenceProfileArn).
The list is
bedrock-models.json, generated from svc-ai's routes and held equal to them bymodules/svc-ai/tests/test_bedrock_infra.py, so a new route cannot be refused by AWS on its first call.Credentials for svc-ai. A systemd timer on the host assumes the role every 20 minutes. Role chaining caps a session at an hour, and botocore re-reads with 15 minutes left, so one missed refresh is harmless.
The session is written in
credential_processformat to/etc/chainr/aws/(root:999,0640), mounted read-only into svc-ai alone at/run/aws.svc-ai runs with
AWS_CONFIG_FILE=/run/aws/configandAWS_EC2_METADATA_DISABLED=true. The metadata hop limit stays 1, so no container can reach the instance role.The Deploy stage installs the timer as root between
git pulland the deploy. WithINFERENCE_BACKEND=bedrock,deploy-on-host.shrefuses to roll forward without a session written in the last 30 minutes.
The SCP.
bedrock:*leaves the general region deny for a statement of its own: it denies Bedrock outside London and us-east-1 unless the request comes through aneu.profile called from London.From London, the EU profile routes to eu-central-1, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2 and eu-west-3. It keeps working whichever EU Regions AWS adds to it.
A model invoked directly in another Region is still denied.
Global profiles (
aws:RequestedRegion = unspecified) are refused, because no route needs one; a test fails if a Global route is added without allowing them.
The kill switch. A Lambda runs every 5 minutes.
It reads the day's and month's
InputTokenCount,OutputTokenCount,CacheReadInputTokenCountandCacheWriteInputTokenCountper model from CloudWatch. These are published by the London endpoint, profiles included.It prices them with the catalogue's Bedrock rates. A model outside the table is priced at the dearest rate.
While the UTC day's estimate is at or over $20, or the month's over $200, it attaches a deny to the role. The deny holds on sessions already issued.
It lifts the deny when the period rolls over, the same reset as svc-ai's ceiling, and emails both changes.
It may attach and detach those two policies on that role and nothing else.
Alarms report it failing, or not running for an hour.
It catches a fault in svc-ai's accounting or a leaked session within minutes. Its estimate counts long-context prompts at the base rate, which svc-ai's ceiling does not.
It costs about $3 a month in CloudWatch API calls.
The backstop. $200 monthly budgets on billed spend, one per billing line: AWS Marketplace (Claude) and Amazon Bedrock (the open-weight models and embeddings), since a budget's filters cannot cover both. Either's action applies a third copy of the deny, which a person reverses: billing data lags 8–24 hours, so when this acts, something has gone wrong that should be looked at.
An account budget ($350) alerts on all costs.
Anomaly alerts ($10 or more) come from the account's AWS services monitor, which Terraform creates. An account may have only one, so where AWS has already made it, it is imported instead.
Everything goes to one SNS topic, emailed to
cost_alert_email.
Not built.
A
bedrock-runtimeVPC endpoint (about $8 a month). Model traffic leaves over TLS through the internet gateway, like the vendors' APIs today.Lowering Bedrock's tokens-per-minute quotas, which would cap the spend rate outright.
Switching a deployment to Bedrock, in order:
The SCP, from the management account (
infra/aws/scps/README.md).The Terraform: run
terraform init(new provider:hashicorp/archive), thenterraform apply. Confirm the alert subscription emailed tocost_alert_email.SSM: set
ai/INFERENCE_BACKEND=direct,ai/BEDROCK_REGION=eu-west-2,ai/LLM_DAILY_CEILING_USD/ai/LLM_MONTHLY_CEILING_USD=15/150, andai/BEDROCK_MODEL_ACCESS(all, or the vendors the account may use). Then deploy, which installs the credential timer.Model access in the Bedrock console for each routed model, plus Anthropic's use-case form.
The sub-processor facts. Done 8 October 2026:
Settings → Data names AWS (Amazon Bedrock), not Anthropic, for each model it runs, with the regions, from each model's
inference_backend.docs/business/sub-processors.mdis rewritten for this configuration.
ai/INFERENCE_BACKEND=bedrock, then deploy. The seeder reprices the catalogue, marks the GPT models unavailable and moves the default to Claude Haiku 5.5. The next benchmark tick runs every Bedrock model.
Also before switching:
The sub-processor facts are done (step 5). OpenAI stays a sub-processor for embeddings until section 4's operator steps have run and its key is removed.
Enable model access in the Bedrock console for each routed model. Claude models may also need Anthropic's use-case form. Until access is granted, a call fails with
AccessDeniedException, which svc-ai reports as a permission error.
4. Embeddings
Built 9 October 2026. Knowledge is indexed and searched with Titan Text Embeddings V2 in London (amazon.titan-embed-text-v2:0, 1024 dimensions, in-region only) on a Bedrock deployment, and with OpenAI's text-embedding-3-small (1536) on direct. Bedrock Knowledge Bases were not used: they would replace the hybrid retrieval, graph seeding and citations, and add OpenSearch's cost.
svc-ai (app/services/embeddings.py):
One embedder per inference backend, a registry like the routes, so the embedding model follows
INFERENCE_BACKENDand cannot drift from it (embeddings.active()).EMBEDDING_MODELis gone.Every chunk is checked and metered: the spending ceiling first, then one metered call per chunk priced on the catalogue row (both embedding models are seeded rows), then a dimension check on every vector. Titan takes one text per request, so a chunk is up to 64 requests; the tokens of requests that succeeded are metered before a failure is raised.
Paced to the account's quota. Bedrock throttles Titan per request: 6,000 a minute in London (checked 9 October 2026). Every request takes the next slot of an even pace at 80% of
EMBEDDING_RPM_QUOTA(default 6000, so 80 a second), overEMBEDDING_CONCURRENCYthreads (default 8, enough for that pace at ~100 ms a request); botocore's adaptive retry absorbs any throttling left. The other 20% is for anything else calling Titan in the account and region. svc-ai runs one uvicorn worker, so the pace is the deployment's; a second environment in the same account shares the quota, and each should then set its share.Input is capped at 8,000 characters, under Titan's 8,192-token limit in any script (chunks are 512 tokens; only a long query is cut).
Titan is a route like any other:
BEDROCK_MODEL_ACCESSmust includeamazon, or every embed is refused as a permission error (a 502 with itscodeon/knowledge/embed). The invoke role's allowlist and the kill switch's prices come frombedrock-models.json(kind: "embedding").Similarity floors belong to the embedder. A cosine score means different things in different spaces, so
score_thresholddefaults to the embedder's floor (SimilarityFloors: standard, strict, loose). Titan's (0.25 / 0.5 / 0.15) are provisional; tune them against the guide after the rebuild.A collection built with another model is never queried with this one. Each collection records its model in Qdrant's collection metadata (
{"embedding": {"key": "provider/model/dimensions", …}}; one with none and 1536 dimensions is OpenAI's). Search skips the dense leg on a mismatch, before embedding the query, and says the knowledge base is being re-indexed.GET /knowledge/embeddingnames the active model for svc-core.
svc-core:
Indexing checks the collection before spending anything (
qdrant_client.ensure_collection): a missing collection is created with the model's metadata, a current legacy one gains it, and a stale one leaves the documentpendinguntil the rebuild. Every indexed document records its model (document_metadata.embedding).The rebuild is the
knowledge_reindexscheduled job (app/services/knowledge/reindex.py), every minute, 45 seconds a tick. It probes the new model before replacing anything, then per knowledge base marks the documents pending, recreates the collection at the new size and re-embeds from what is stored: an upload's file in MinIO, a web page's newest snapshot (News included; a source being crawled waits), the guide on disk. Nothing is fetched again, and graph sources hold no vectors. It keeps no state of its own, so it resumes across restarts; it holds once the deployment has spent 90% of its ceiling, and leaves a document after three failed attempts. Each knowledge base is one Background event on the Activity page (knowledge_reindex, triggermodel_changed); owned work is ledgered against its knowledge base like any indexing (theknowledge_indexingpath), and built-in knowledge is the platform's. The platform benchmark waits until the guide is rebuilt.Rule targets and the model catalogue a lighter model is chosen from offer chat models only, so an embedding model is never chosen to answer.
While a knowledge base waits keyword search still answers from the old collection; once it is recreated, results return as its documents are re-indexed. Verified against a real Postgres and Qdrant 1.17 with svc-ai stubbed. A live Titan call has not been made from this environment. That verification did not cover svc-ai's own searches. Its dense leg called AsyncQdrantClient.search, which qdrant-client 1.17 does not have, so until October 2026 every search was keyword-only. svc-ai now queries with query_points, held to the installed client by tests/services/test_qdrant_contract.py (retrieval.md).
Runbook:
Done 9 October 2026: Titan's London price is $0.10 per million input tokens on demand ($0.05 batch, unused), as catalogued, and its quota is 6,000 requests a minute,
EMBEDDING_RPM_QUOTA's default. At that pace a rebuild embeds at most about 3,600 chunks a minute (45 seconds of each minute's tick), roughly $0.18 a minute, well inside the spending ceiling. Re-check both if the account's quota is raised or another environment joins the account.terraform apply: Titan joins the invoke role's allowlist and the kill switch's prices, and theEMBEDDING_MODELparameter is removed.SSM
ai/BEDROCK_MODEL_ACCESS=amazon,openai,qwen(orall).Enable Titan Text Embeddings V2 in the Bedrock console if it is not, and smoke-test it as the invoke role:
aws bedrock-runtime invoke-model --region eu-west-2 --model-id amazon.titan-embed-text-v2:0 --body '{"inputText":"hello","dimensions":1024,"normalize":true}' --cli-binary-format raw-in-base64-out /dev/stdoutDeploy. Watch
GET /monitoring/scheduler(knowledge_reindexok, then skipped), Activity → Background (one rebuild per knowledge base), andGET /spend.Once search answers with citations and CHAINR Bot cites the guide, set
ai/OPENAI_API_KEY=noneand revoke the key. OpenAI then receives nothing.
5. Brave and other third-party costs
Buy Brave through AWS Marketplace; no code change.
The rest, each in a different place today, need a register of where each is billed:
Auth0 (US-hosted tenant)
MaxMind
Cloudflare
CARTO
the market-data API
6. Shared benchmarks
Benchmarks cost money and should read the same in every environment, but a score is only shareable between environments that measured the same thing. Today results are per database, keyed partly on a per-database dataset version number and on the is_default model, with no export. The plan:
Key results by content. A result's identity covers:
the dataset content hash (not the version number);
the judge;
the model's provider and id;
for CHAINR Bot,
pipeline_key(both services' code fingerprints and the default model).
One producer. One environment runs the benchmark and publishes results to S3.
Every other environment imports the results whose key matches its own configuration, and shows "not measured for this configuration" otherwise, never another configuration's score.
Build it with the second environment. Only
devexists in Terraform today. The content keys are cheap to add earlier.
Steps
Spending ceiling. Built.
Bedrock provider, catalogue and capabilities, with the default model chosen on the gold datasets. Ship it with the gold-dataset review.
Credentials, SCP, kill switch, Budgets and anomaly detection. Built; an operator applies them (section 3's runbook). Needed before step 2 can run in an environment.
Titan V2 embeddings and re-index. Built; the operator steps are section 4's runbook.
Brave through Marketplace. Procurement only.
Shared benchmarks. When a second environment exists.