adapters: openai is a static-key vendor #17

Merged
jschoubben merged 1 commits from feat/openai-access into main 2026-09-07 02:25:54 +00:00
2 changed files with 11 additions and 0 deletions
+1
View File
@@ -167,6 +167,7 @@ type UsageRow struct {
var registry = map[string]Shape{ var registry = map[string]Shape{
"anthropic": RefreshableGrant, "anthropic": RefreshableGrant,
"anthropic-api-key": StaticKey, "anthropic-api-key": StaticKey,
"openai": StaticKey,
} }
// For returns the adapter for a vendor, refusing an unknown one clearly. // For returns the adapter for a vendor, refusing an unknown one clearly.
@@ -22,6 +22,16 @@ func TestTheTwoShapesAreSelectedByVendor(t *testing.T) {
if grant.Shape() != RefreshableGrant { if grant.Shape() != RefreshableGrant {
t.Fatalf("anthropic is %q, expected refreshable-grant", grant.Shape()) t.Fatalf("anthropic is %q, expected refreshable-grant", grant.Shape())
} }
// openai is a second static-key vendor, served by the same generic adapter — the registry line is
// the whole of its integration, and it reports the static-key shape like any other.
openai, err := For("openai")
if err != nil {
t.Fatal(err)
}
if openai.Shape() != StaticKey {
t.Fatalf("openai is %q, expected static-key", openai.Shape())
}
} }
// The type assertion is what gates the carve-out: a static key is not a Refresher, so it can never // The type assertion is what gates the carve-out: a static key is not a Refresher, so it can never