Repository navigation
feat(inference): support workload identity federation #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b024dbf
feat(inference): support workload identity federation
danielkov 2aff19a
fix(inference): redact failures before turn creation
danielkov 06c3838
fix(inference): keep production items before test support
danielkov 36176cb
fix(inference): preserve credential-free provider attribution
danielkov 7927357
fix(inference): preserve budgets and renew refused workload grants
danielkov 187d743
fix(inference): align Speakeasy workload resource contract
danielkov 7589544
docs(inference): separate workload identity deployment guide
danielkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Workload identity for inference | ||
|
|
||
| Use workload identity for deployed workloads that receive projected identity tokens. | ||
| For interactive local use, follow [provider authentication](getting-started-and-configuration.md#choose-a-provider-and-authenticate) instead. | ||
|
|
||
| For `openrouter` or `speakeasy`, configure a provider-specific workload exchange | ||
| in `~/.kit/config.toml`. Kit reads a deployment-projected JWT file; it does not | ||
| mint the external assertion. The deployment must rotate that file before renewal. | ||
| These settings override API-key and browser credentials for that provider only. | ||
| An exchange failure stops inference: Kit never falls back to another credential. | ||
|
|
||
| OpenRouter uses [workload identity federation](https://openrouter.ai/docs/guides/overview/auth/workload-identity-federation) | ||
| with an organization federation policy targeting an inference-capable key: | ||
|
|
||
| ```toml | ||
| provider = "openrouter" | ||
| model = "anthropic/claude-sonnet-4" | ||
|
|
||
| [inference_providers.openrouter] | ||
| endpoint = "https://openrouter.ai/api/v1/chat/completions" | ||
| [inference_providers.openrouter.workload] | ||
| tokenFile = "/var/run/identity/assertion.jwt" | ||
| endpointMode = "explicit" | ||
| grant = "tokenExchange" | ||
| tokenEndpoint = "https://openrouter.ai/api/v1/oauth/token" | ||
| scope = "inference" | ||
| [inference_providers.openrouter.workload.extensions] | ||
| federation_policy_id = "<FEDERATION_POLICY_ID>" | ||
| ``` | ||
|
|
||
| Speakeasy uses its shared workload issuer's JWT-bearer token endpoint. Configure | ||
| issuer trust and project authorization on the server first, then use the actual | ||
| token endpoint returned for that issuer: | ||
|
|
||
| ```toml | ||
| provider = "speakeasy" | ||
| model = "anthropic/claude-sonnet-4" | ||
|
|
||
| [inference_providers.speakeasy] | ||
| endpoint = "https://ai.speakeasy.com/chat/completions" | ||
| [inference_providers.speakeasy.workload] | ||
| tokenFile = "/var/run/identity/assertion.jwt" | ||
| endpointMode = "explicit" | ||
| grant = "jwtBearer" | ||
| tokenEndpoint = "https://ai.speakeasy.com/oauth/usi/<ISSUER_ID>/token" | ||
| resource = "urn:speakeasy:inference" | ||
| [inference_providers.speakeasy.workload.extensions] | ||
| project_id = "<PROJECT_ID>" | ||
| ``` | ||
|
|
||
| The Speakeasy assertion's audience is the shared issuer URL or its token endpoint, | ||
| not `urn:speakeasy:inference`. Assertions with a `jti` (or `uti`) are single-use: a new | ||
| exchange needs a fresh assertion. This is ordinary workload inference, not a | ||
| replacement for managed assistant credentials or chat-bound authorization. Kit | ||
| sends bearer authentication without API-key, project, or assistant/chat headers. | ||
|
|
||
| Both examples pin HTTPS token and completion endpoints explicitly; redirects are | ||
| disabled. Optional `audience`, `resource`, `scope`, and string-valued `extensions` | ||
| belong to the workload exchange, not completion headers. `endpointMode = "discovery"` | ||
| instead requires `expectedIssuer`, same-origin issuer metadata, and an HTTPS | ||
| `resource`; use explicit mode for Speakeasy's inference URN. Keep this configuration | ||
| operator-controlled: the endpoints determine where credentials are sent. | ||
|
|
||
| Kit shares in-memory tokens across sessions for each configured provider, caches | ||
| only until the returned `expires_in` minus a safety margin, and rereads the source | ||
| file on renewal. An RFC 8693 response without `expires_in` is used once and not | ||
| cached. A token may outlive its source assertion when the server permits it. | ||
| Tokens and assertions are not saved in Kit's credential store. Workload requests | ||
| are not automatically replayed on authentication refusal, throttling, or server | ||
| errors; API-key retry behavior is unchanged. Select models explicitly: workload | ||
| grants do not imply model-catalog access, and Kit does not discover a context limit | ||
| through these grants. Other features with separate credentials (such as images or | ||
| evaluation) are not authenticated by this configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.