Bring Your Own Bedrock
What it does
Kimi K3 (moonshotai/Kimi-K3) calls run on your own Amazon Bedrock account instead of Brainbase's hosted provider. AWS bills those calls to you, and they use no Brainbase credits. Sandbox time still uses credits, and a team with no credits is still blocked from running tasks.
This applies to Kimi K3 only. Every other model keeps its current provider. With no credential saved, Kimi K3 runs exactly as it does today.
When a credential applies, Brainbase never falls back to its hosted provider. If your AWS account refuses a call, the turn fails with the reason, and you fix it on the AWS side or in the credential.
Where to set it
| Scope | Where | Who can manage it |
|---|---|---|
| Organization | Settings > Kimi K3 on your AWS account | Org owners and admins |
| User | Settings > Your AWS credential for Kimi K3, for the org you have selected | You. It applies only to tasks you own in that org. |
| Agent | The agent's Secrets page | Anyone who can edit the agent |
Each scope holds one credential. For every Kimi K3 call, Brainbase uses the most specific credential that applies: the agent's credential, then the task owner's user credential, then the org credential. A failing credential never falls back to a less specific one.
- Task owner: The task owner is fixed when the task is created. A teammate who sends messages in someone else's task uses the task owner's credential.
- Override switch: Org owners and admins can block member (user) and agent overrides. Overrides are allowed by default. When they are blocked, only the org credential is used.
- Leaving an org: When a user leaves an org, their user credential for that org is deleted.
- Changes apply on the next call: A new, replaced, or deleted credential takes effect on the next model call, including inside a thread that is already running.
- Admin overrides table: Org owners and admins see a table of the user and agent credentials in the org: who saved each one, its region, and the AWS account when known. They never see the secret.
- Which source served a task: Each task shows which credential served its Kimi K3 turns, including turns that failed at AWS. The agent page shows which source Kimi K3 will use when you start a task.
Credentials
The form accepts one of two credential types:
- IAM access key: An access key ID and secret access key, with an optional session token. A session token means the credentials are temporary and expire within hours, so the form warns about it. Replace them when they expire.
- Bedrock API key: A key created in the Amazon Bedrock console. It works only in the region it was created in.
A saved secret is never shown again. Brainbase shows the credential type, a masked key hint, the region, the data location, who saved it and when, and the last test result. For IAM keys it also shows the AWS account ID to people who can manage that credential and to org admins. For Bedrock API keys the account is shown as unknown.
Replacing or deleting a credential destroys the old secret in Brainbase. If two people save the same scope at the same time, the later save is refused with a conflict message. Creating, replacing, deleting, and testing a credential, and moving an agent with a credential to another org, are recorded in an audit trail with the scope, the masked key hint, and who made the change when it was made in Brainbase. Changing the override switch is recorded with who changed it and the org.
Region and data location
Pick the region of your AWS account and a data location. The form offers only the data locations that are valid for the region you selected.
| Data location | Allowed regions | Notes |
|---|---|---|
| Global (default) | Any of the 32 regions listed below | AWS can route the request to any supported commercial region. |
| US only | us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, ca-west-1 | From ca-central-1 and ca-west-1, AWS may also serve the request in that Canadian region. |
| India only | ap-south-1, ap-south-2 | Only the two India regions are used. |
The 32 source regions available with Global:
| Area | Regions |
|---|---|
| US and Canada | us-east-1, us-east-2, us-west-1, us-west-2, ca-central-1, ca-west-1 |
| Europe | eu-central-1, eu-central-2, eu-north-1, eu-south-1, eu-south-2, eu-west-1, eu-west-2, eu-west-3 |
| Asia Pacific | ap-east-2, ap-northeast-1, ap-northeast-2, ap-northeast-3, ap-south-1, ap-south-2, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-4, ap-southeast-5, ap-southeast-6, ap-southeast-7 |
| Middle East, Israel, Africa | il-central-1, me-central-1, me-south-1, af-south-1 |
| South America | sa-east-1 |
Test connection
Test connection runs automatically after every save, and you can run it again yourself. One test runs at a time per credential, each person can run 5 a minute, and an org (or an agent's credential) can run 50 a day. A test that hits a limit says when to retry, and a test after a save is skipped when the limit is reached. It makes one minimal Kimi K3 call on your account, which costs a fraction of a cent, and shows either success or the error from the table below. For IAM keys, a successful test also shows the AWS account ID when AWS reports it; if that lookup fails, the test still passes without an account ID.
IAM policies
The policies below grant only what Kimi K3 calls need. Treat them as starting points and adapt them to your account's own policy conventions. Replace <source-region> with the region you saved in Brainbase and <account-id> with your 12-digit AWS account ID.
Each policy allows bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream on the Kimi K3 inference profile, and on the foundation models that profile routes to, only when the call comes through that profile.
Global data location
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InvokeKimiK3InferenceProfile",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:<source-region>:<account-id>:inference-profile/global.moonshotai.kimi-k3"
},
{
"Sid": "InvokeKimiK3FoundationModels",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:*::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:::foundation-model/moonshotai.kimi-k3"
],
"Condition": {
"StringLike": {
"bedrock:InferenceProfileArn": "arn:aws:bedrock:<source-region>:<account-id>:inference-profile/global.moonshotai.kimi-k3"
}
}
}
]
}
US only data location
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InvokeKimiK3InferenceProfile",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:<source-region>:<account-id>:inference-profile/us.moonshotai.kimi-k3"
},
{
"Sid": "InvokeKimiK3FoundationModels",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:us-east-1::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:us-east-2::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:us-west-1::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:us-west-2::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:ca-central-1::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:ca-west-1::foundation-model/moonshotai.kimi-k3"
],
"Condition": {
"StringLike": {
"bedrock:InferenceProfileArn": "arn:aws:bedrock:<source-region>:<account-id>:inference-profile/us.moonshotai.kimi-k3"
}
}
}
]
}
India only data location
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "InvokeKimiK3InferenceProfile",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": "arn:aws:bedrock:<source-region>:<account-id>:inference-profile/in.moonshotai.kimi-k3"
},
{
"Sid": "InvokeKimiK3FoundationModels",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:ap-south-1::foundation-model/moonshotai.kimi-k3",
"arn:aws:bedrock:ap-south-2::foundation-model/moonshotai.kimi-k3"
],
"Condition": {
"StringLike": {
"bedrock:InferenceProfileArn": "arn:aws:bedrock:<source-region>:<account-id>:inference-profile/in.moonshotai.kimi-k3"
}
}
}
]
}
Two additions depend on how you connect:
- Bedrock API keys: Add a statement that allows
bedrock:CallWithBearerTokenfor the IAM user or role that owns the key. - Agents on the Codex harness: Codex calls Bedrock through the Responses API. Also allow
bedrock:InvokeModelonarn:aws:bedrock:<source-region>:<account-id>:project/default.
Example additional statements
[
{
"Sid": "BedrockApiKeyAuth",
"Effect": "Allow",
"Action": "bedrock:CallWithBearerToken",
"Resource": "*"
},
{
"Sid": "CodexResponsesApi",
"Effect": "Allow",
"Action": "bedrock:InvokeModel",
"Resource": "arn:aws:bedrock:<source-region>:<account-id>:project/default"
}
]
Supported agent types
Kimi K3 on your Bedrock account works with OpenCode, Pi, Kafka, Qwen, and Codex agents. Claude Code and Kafka Legacy agents cannot use it: while a credential applies, their Kimi K3 turns fail with a message that names the supported agent types. Either remove the credential or switch to a supported agent type.
Errors and fixes
When AWS refuses a call, the turn ends with a message mapped from the AWS error. The message never contains secret material, account IDs, or ARNs. Context-length errors still trigger the harness's normal context compaction.
| Message | Cause | Fix |
|---|---|---|
| The AWS key ID is not recognized. It may be deleted or mistyped. | The access key was deleted or mistyped. | Check the key ID in IAM, or create a new key and replace the credential. |
| The AWS secret does not match the key ID. | The secret access key is wrong for that key ID. | Re-enter both values, or create a new key. |
| These temporary AWS credentials have expired. Replace them, or use a long-term key. | The session token has passed its expiry. | Replace the credential with fresh temporary credentials, or use a long-term key. |
| This Bedrock API key was not accepted. It may be invalid, expired, revoked, or created for a different region than the one saved. | The key is invalid, expired, revoked, or was created in a different region. | Create a new Bedrock API key in the region you saved, or change the saved region to match. |
| AWS denied access to Kimi K3. The IAM policy must allow invoking the Kimi K3 inference profile and model. | The IAM policy does not allow the call. | Allow the actions and resources in the IAM policies section. The message names the missing action when AWS reports it. |
| AWS is still verifying this AWS account for Bedrock in this region. Verification normally takes under two hours. Try again later. | AWS has not finished verifying the account for Bedrock in that region. | Wait for AWS to finish, then run Test connection again. Contact AWS support if it persists. |
| Kimi K3 is not available with this region and data location, or the request was invalid. | The model is not offered for that region and data location, or AWS refused a field in the request. The message ends with AWS's own explanation. | Pick a region and data location from the tables above. If the region is listed, read AWS's explanation in the message. |
| Your AWS account's Bedrock quota for Kimi K3 is used up. Request a quota increase in AWS. | The account has reached a Bedrock quota. | Request a quota increase in AWS Service Quotas. |
| AWS is throttling Bedrock requests on your account. | Requests are arriving faster than your account's rate limit. | Retry shortly, or request a quota increase. |
| AWS Bedrock is temporarily out of capacity. | AWS returned a temporary capacity error. | Retry shortly. Try a different region if it continues. |
| AWS Bedrock timed out. / AWS Bedrock did not respond in time. | AWS did not answer in time. | Retry. Check AWS service health for the region. |
| AWS Bedrock did not respond within 20 seconds. Try again. | A connection test did not finish in time. | Run Test connection again. |
| AWS did not accept these credentials. | AWS rejected the credentials for a reason it did not specify. | Re-enter the credential, or create a new key and replace it. |
| AWS Bedrock rejected the request as invalid. | AWS refused the request itself, not the credential. | Retry. If it persists, contact Brainbase support with the time of the failure. |
| AWS Bedrock returned an unexpected response. | AWS answered in a form Brainbase could not read. | Retry. If it persists, contact Brainbase support with the time of the failure. |
| The saved AWS Bedrock credential for Kimi K3 could not be used, so this turn was not run. | Brainbase could not load or check the saved credential, or the agent's org does not match the task. | Check or replace the credential, then try again. If it persists, contact Brainbase support. |
| Could not connect to AWS Bedrock. / The connection to AWS Bedrock failed. | The connection to the Bedrock endpoint failed or was cut. | Retry. Check AWS service health for the region. |
| This model's maximum context length was exceeded. Please reduce the length of the messages. | The conversation is longer than Kimi K3 accepts. | Nothing, usually: the harness compacts the context and continues. Start a new task if it persists. |
| The saved AWS region and data location are not a supported combination for Kimi K3. | The saved region does not serve the saved data location. | Replace the credential with a region and data location from the tables above. |
| The saved AWS credential is incomplete and cannot be used. | The stored credential is missing a required value. | Replace the credential. |
| Kimi K3 is set to run on your own AWS Bedrock account, which works with OpenCode, Pi, Kafka, Qwen and Codex agents, but not Claude Code or Kafka Legacy. | The agent type cannot use your Bedrock account. | Switch the agent to a supported type, choose a different model, or remove the credential. |
Throttling and temporary capacity errors are retried automatically before the turn fails. Quota, authentication, and permission errors are not retried.
Limits and data flow
- Title generation and compaction: Both run on Brainbase's hosted Claude and use Brainbase credits. Some conversation content is therefore still processed outside your chosen data location.
- Automatic model selection: When
automodel selection picks Kimi K3, the call uses your Bedrock account. - Task owner's credential: A teammate's messages in someone else's task use the task owner's credential.
- Orchestrations and subagents: Orchestration members and subagents resolve their own credentials. Content passed between them can cross from one AWS account to another.
- Org credential: An org credential lets every member's agents spend on that AWS account.
- Sandboxes: Your credential is never placed in the agent's sandbox. It is used only when Brainbase makes the model call.
Removing a credential
Deleting or replacing a credential in Brainbase does not revoke it in AWS. To stop a key from working, disable or rotate it in IAM, or delete the Bedrock API key in the Bedrock console. Encrypted copies of a deleted credential can persist in Brainbase database backups until the backup retention window ends.