Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ The provided configuration file may include environment variable substitution us
"authorization": "x-api-key",
"apikey": "${ANTHROPIC_API_KEY}",
"capability": {
"models": ["claude-*"],
"models": {
"claude-*": {}
},
"user_agents": ["claude-code"]
},
"compatibility": {
Expand Down Expand Up @@ -120,9 +122,20 @@ When `capability` is set on a provider, Lacuna will use it to filter the request
"anthropic": {
"baseurl": "https://api.anthropic.com",
"capability": {
"models": ["claude-*"],
"models": {
"claude-*": {}
},
"user_agents": ["claude-code"]
}
},
"bedrock": {
"baseurl": "https://bedrock-runtime.us-east-1.amazonaws.com",
"capability": {
"models": {
"us.anthropic.claude-opus-4-5*": { "rewrite": "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abcd1234567" },
"us.anthropic.claude-haiku-4-5*": {}
}
}
}
}
}
Expand All @@ -132,7 +145,12 @@ In the above example:
- The `anthropic` provider will only allow requests with a User-Agent that match Lacuna's built-in `claude-code` pattern.
- The `anthropic` provider may only be used with models that match the `claude-*` glob pattern.

`capability.models` maps each model glob pattern to a settings object with an optional `rewrite`:
- `{}` ⇒ the model is allowed and forwarded as-is.
- `{ "rewrite": "<target>" }` ⇒ the model is allowed and the upstream is called with `<target>` instead. In the example, requests for `us.anthropic.claude-opus-4-5*` are sent to Bedrock as the configured application-inference-profile ARN.

Notes:
- An empty or omitted `models` allows all models (no rewrite).
- Built-in User-Agent patterns can be found in [src/user_agent.rs](src/user_agent.rs).

## 📦 Dev Dependencies
Expand Down
8 changes: 8 additions & 0 deletions examples/lacuna/lacuna.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"baseurl": "https://api.anthropic.com",
"authorization": "x-api-key",
"apikey": "${ANTHROPIC_API_KEY}",
"capability": {
"models": {},
"user_agents": []
},
"compatibility": {
"anthropic_messages": true
}
Expand All @@ -21,6 +25,10 @@
"baseurl": "https://bedrock-runtime.us-east-1.amazonaws.com",
"authorization": "bearer",
"apikey": "${BEDROCK_API_KEY}",
"capability": {
"models": {},
"user_agents": []
},
"compatibility": {
"bedrock_model_invoke": true
},
Expand Down
Loading
Loading