cadenya 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88a495d13fa3197bd62108f4a356f43b3dc8d8b280f6a11584afd3484fbb0135
4
- data.tar.gz: 7cd25a4bbea3d69c830e18e2f61db051165da239d5d41d0c9547b426ea166aa9
3
+ metadata.gz: 56345beed04805e02e3d9160438370098e235277a458b4d99964df96d689d1fa
4
+ data.tar.gz: 48e4a95347381ea29f7f4523d1098af4aab96e1a9a43e5187a6c115120848087
5
5
  SHA512:
6
- metadata.gz: b2f73a4957a9e5f1adcf9b8f51b9a39223a4cf1bc9e8c721c4c4d7ace807ce1eb73acc57cba38847967b99211b87726f1ca625b0ddfeeb140a3526851bfbb7da
7
- data.tar.gz: 8974859e7ae5d2035635ea7f0ea5a3c843cafd2f71b0efae359af83572b73402a81b4d683b306db724fc3b65beecd44eb1b50705f57bef1116f54ff63515ce82
6
+ metadata.gz: 9e343691120327cdd8c6c1d14df4f15d77344f9a625ec59fff2d743999330aacecb0fad0fe0290ebd8bd2094bce006b60e95e225ef4c1f403700542bfe03feff
7
+ data.tar.gz: 218de860735ffcfcc65da64a9ca06675bfee2a54f45c5588ec400e5d330d9cedd7e9730a3078592ad4924d4698a291c2a26fe0baf79f181bbdc527c6b58d540b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.24.0 (2026-07-01)
4
+
5
+ Full Changelog: [v0.23.0...v0.24.0](https://github.com/cadenya/cadenya-ruby/compare/v0.23.0...v0.24.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([2dc6e63](https://github.com/cadenya/cadenya-ruby/commit/2dc6e631c0c63392b148ea3458ce560593bcf27a))
10
+
3
11
  ## 0.23.0 (2026-07-01)
4
12
 
5
13
  Full Changelog: [v0.22.0...v0.23.0](https://github.com/cadenya/cadenya-ruby/compare/v0.22.0...v0.23.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "cadenya", "~> 0.23.0"
20
+ gem "cadenya", "~> 0.24.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -3,20 +3,23 @@
3
3
  module Cadenya
4
4
  module Models
5
5
  class AIProviderKeySpec < Cadenya::Internal::Type::BaseModel
6
- # @!attribute api_key
7
- # The provider credential. Accepted on create/update; never populated in responses
8
- # (the server returns an empty value to avoid leaking it).
6
+ # @!attribute config
7
+ # AIProviderConfig holds non-secret, provider-specific settings. The set case must
8
+ # correspond to AIProviderKeySpec.provider. Providers with no settings (Anthropic,
9
+ # Gemini) simply leave this unset. The endpoint of a named provider is fixed and
10
+ # intentionally not overridable here; use the OpenAI-compatible provider to target
11
+ # a custom endpoint.
9
12
  #
10
- # @return [String, nil]
11
- optional :api_key, String, api_name: :apiKey
13
+ # @return [Cadenya::Models::AIProviderKeySpec::Config, nil]
14
+ optional :config, -> { Cadenya::AIProviderKeySpec::Config }
12
15
 
13
- # @!attribute openrouter
14
- # OpenRouterConfig holds OpenRouter-specific settings. Empty for now; it exists as
15
- # the oneof seam so provider-specific options (region, base URL, etc.) can be
16
- # added later without restructuring the spec.
16
+ # @!attribute credentials
17
+ # AIProviderCredential is the secret material used to authenticate with a
18
+ # provider. The set case must correspond to AIProviderKeySpec.provider. The server
19
+ # encrypts the serialized message at rest and never returns it on reads.
17
20
  #
18
- # @return [Object, nil]
19
- optional :openrouter, Cadenya::Internal::Type::Unknown
21
+ # @return [Cadenya::Models::AIProviderKeySpec::Credentials, nil]
22
+ optional :credentials, -> { Cadenya::AIProviderKeySpec::Credentials }
20
23
 
21
24
  # @!attribute provider
22
25
  # The AI provider this key authenticates against.
@@ -24,16 +27,163 @@ module Cadenya
24
27
  # @return [Symbol, Cadenya::Models::AIProviderKeySpec::Provider, nil]
25
28
  optional :provider, enum: -> { Cadenya::AIProviderKeySpec::Provider }
26
29
 
27
- # @!method initialize(api_key: nil, openrouter: nil, provider: nil)
30
+ # @!method initialize(config: nil, credentials: nil, provider: nil)
28
31
  # Some parameter documentations has been truncated, see
29
32
  # {Cadenya::Models::AIProviderKeySpec} for more details.
30
33
  #
31
- # @param api_key [String] The provider credential. Accepted on create/update; never populated in
34
+ # @param config [Cadenya::Models::AIProviderKeySpec::Config] AIProviderConfig holds non-secret, provider-specific settings. The set case
32
35
  #
33
- # @param openrouter [Object] OpenRouterConfig holds OpenRouter-specific settings. Empty for now; it exists
36
+ # @param credentials [Cadenya::Models::AIProviderKeySpec::Credentials] AIProviderCredential is the secret material used to authenticate with a
34
37
  #
35
38
  # @param provider [Symbol, Cadenya::Models::AIProviderKeySpec::Provider] The AI provider this key authenticates against.
36
39
 
40
+ # @see Cadenya::Models::AIProviderKeySpec#config
41
+ class Config < Cadenya::Internal::Type::BaseModel
42
+ # @!attribute openai
43
+ # OpenAIConfig holds OpenAI-specific settings.
44
+ #
45
+ # @return [Cadenya::Models::AIProviderKeySpec::Config::OpenAI, nil]
46
+ optional :openai, -> { Cadenya::AIProviderKeySpec::Config::OpenAI }
47
+
48
+ # @!attribute openai_compatible
49
+ # OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
50
+ # Completions API. The base URL is required and its model catalog is discovered
51
+ # live via GET {base_url}/models.
52
+ #
53
+ # @return [Cadenya::Models::AIProviderKeySpec::Config::OpenAICompatible, nil]
54
+ optional :openai_compatible,
55
+ -> { Cadenya::AIProviderKeySpec::Config::OpenAICompatible },
56
+ api_name: :openaiCompatible
57
+
58
+ # @!attribute openrouter
59
+ # OpenRouterConfig holds OpenRouter-specific settings.
60
+ #
61
+ # @return [Cadenya::Models::AIProviderKeySpec::Config::Openrouter, nil]
62
+ optional :openrouter, -> { Cadenya::AIProviderKeySpec::Config::Openrouter }
63
+
64
+ # @!method initialize(openai: nil, openai_compatible: nil, openrouter: nil)
65
+ # Some parameter documentations has been truncated, see
66
+ # {Cadenya::Models::AIProviderKeySpec::Config} for more details.
67
+ #
68
+ # AIProviderConfig holds non-secret, provider-specific settings. The set case must
69
+ # correspond to AIProviderKeySpec.provider. Providers with no settings (Anthropic,
70
+ # Gemini) simply leave this unset. The endpoint of a named provider is fixed and
71
+ # intentionally not overridable here; use the OpenAI-compatible provider to target
72
+ # a custom endpoint.
73
+ #
74
+ # @param openai [Cadenya::Models::AIProviderKeySpec::Config::OpenAI] OpenAIConfig holds OpenAI-specific settings.
75
+ #
76
+ # @param openai_compatible [Cadenya::Models::AIProviderKeySpec::Config::OpenAICompatible] OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI
77
+ #
78
+ # @param openrouter [Cadenya::Models::AIProviderKeySpec::Config::Openrouter] OpenRouterConfig holds OpenRouter-specific settings.
79
+
80
+ # @see Cadenya::Models::AIProviderKeySpec::Config#openai
81
+ class OpenAI < Cadenya::Internal::Type::BaseModel
82
+ # @!attribute organization_id
83
+ # Sent as the OpenAI-Organization header when set.
84
+ #
85
+ # @return [String, nil]
86
+ optional :organization_id, String, api_name: :organizationId
87
+
88
+ # @!attribute project_id
89
+ # Sent as the OpenAI-Project header when set.
90
+ #
91
+ # @return [String, nil]
92
+ optional :project_id, String, api_name: :projectId
93
+
94
+ # @!method initialize(organization_id: nil, project_id: nil)
95
+ # OpenAIConfig holds OpenAI-specific settings.
96
+ #
97
+ # @param organization_id [String] Sent as the OpenAI-Organization header when set.
98
+ #
99
+ # @param project_id [String] Sent as the OpenAI-Project header when set.
100
+ end
101
+
102
+ # @see Cadenya::Models::AIProviderKeySpec::Config#openai_compatible
103
+ class OpenAICompatible < Cadenya::Internal::Type::BaseModel
104
+ # @!attribute base_url
105
+ #
106
+ # @return [String, nil]
107
+ optional :base_url, String, api_name: :baseUrl
108
+
109
+ # @!method initialize(base_url: nil)
110
+ # OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
111
+ # Completions API. The base URL is required and its model catalog is discovered
112
+ # live via GET {base_url}/models.
113
+ #
114
+ # @param base_url [String]
115
+ end
116
+
117
+ # @see Cadenya::Models::AIProviderKeySpec::Config#openrouter
118
+ class Openrouter < Cadenya::Internal::Type::BaseModel
119
+ # @!attribute region
120
+ # Data-residency region (e.g. "us", "eu"). Empty uses the provider default.
121
+ #
122
+ # @return [String, nil]
123
+ optional :region, String
124
+
125
+ # @!method initialize(region: nil)
126
+ # OpenRouterConfig holds OpenRouter-specific settings.
127
+ #
128
+ # @param region [String] Data-residency region (e.g. "us", "eu"). Empty uses the provider default.
129
+ end
130
+ end
131
+
132
+ # @see Cadenya::Models::AIProviderKeySpec#credentials
133
+ class Credentials < Cadenya::Internal::Type::BaseModel
134
+ # @!attribute api_key
135
+ # CredentialAPIKey carries a single bearer/header API key.
136
+ #
137
+ # @return [Cadenya::Models::AIProviderKeySpec::Credentials::APIKey, nil]
138
+ optional :api_key, -> { Cadenya::AIProviderKeySpec::Credentials::APIKey }, api_name: :apiKey
139
+
140
+ # @!attribute headers
141
+ # CredentialHeaders carries arbitrary HTTP headers sent with every request to the
142
+ # provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
143
+ #
144
+ # @return [Cadenya::Models::AIProviderKeySpec::Credentials::Headers, nil]
145
+ optional :headers, -> { Cadenya::AIProviderKeySpec::Credentials::Headers }
146
+
147
+ # @!method initialize(api_key: nil, headers: nil)
148
+ # Some parameter documentations has been truncated, see
149
+ # {Cadenya::Models::AIProviderKeySpec::Credentials} for more details.
150
+ #
151
+ # AIProviderCredential is the secret material used to authenticate with a
152
+ # provider. The set case must correspond to AIProviderKeySpec.provider. The server
153
+ # encrypts the serialized message at rest and never returns it on reads.
154
+ #
155
+ # @param api_key [Cadenya::Models::AIProviderKeySpec::Credentials::APIKey] CredentialAPIKey carries a single bearer/header API key.
156
+ #
157
+ # @param headers [Cadenya::Models::AIProviderKeySpec::Credentials::Headers] CredentialHeaders carries arbitrary HTTP headers sent with every request to
158
+
159
+ # @see Cadenya::Models::AIProviderKeySpec::Credentials#api_key
160
+ class APIKey < Cadenya::Internal::Type::BaseModel
161
+ # @!attribute api_key
162
+ #
163
+ # @return [String, nil]
164
+ optional :api_key, String, api_name: :apiKey
165
+
166
+ # @!method initialize(api_key: nil)
167
+ # CredentialAPIKey carries a single bearer/header API key.
168
+ #
169
+ # @param api_key [String]
170
+ end
171
+
172
+ # @see Cadenya::Models::AIProviderKeySpec::Credentials#headers
173
+ class Headers < Cadenya::Internal::Type::BaseModel
174
+ # @!attribute headers
175
+ #
176
+ # @return [Hash{Symbol=>String}, nil]
177
+ optional :headers, Cadenya::Internal::Type::HashOf[String]
178
+
179
+ # @!method initialize(headers: nil)
180
+ # CredentialHeaders carries arbitrary HTTP headers sent with every request to the
181
+ # provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
182
+ #
183
+ # @param headers [Hash{Symbol=>String}]
184
+ end
185
+ end
186
+
37
187
  # The AI provider this key authenticates against.
38
188
  #
39
189
  # @see Cadenya::Models::AIProviderKeySpec#provider
@@ -42,6 +192,10 @@ module Cadenya
42
192
 
43
193
  AI_PROVIDER_UNSPECIFIED = :AI_PROVIDER_UNSPECIFIED
44
194
  AI_PROVIDER_OPENROUTER = :AI_PROVIDER_OPENROUTER
195
+ AI_PROVIDER_OPENAI = :AI_PROVIDER_OPENAI
196
+ AI_PROVIDER_ANTHROPIC = :AI_PROVIDER_ANTHROPIC
197
+ AI_PROVIDER_GEMINI = :AI_PROVIDER_GEMINI
198
+ AI_PROVIDER_OPENAI_COMPATIBLE = :AI_PROVIDER_OPENAI_COMPATIBLE
45
199
 
46
200
  # @!method self.values
47
201
  # @return [Array<Symbol>]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cadenya
4
- VERSION = "0.23.0"
4
+ VERSION = "0.24.0"
5
5
  end
@@ -8,22 +8,29 @@ module Cadenya
8
8
  T.any(Cadenya::AIProviderKeySpec, Cadenya::Internal::AnyHash)
9
9
  end
10
10
 
11
- # The provider credential. Accepted on create/update; never populated in responses
12
- # (the server returns an empty value to avoid leaking it).
13
- sig { returns(T.nilable(String)) }
14
- attr_reader :api_key
11
+ # AIProviderConfig holds non-secret, provider-specific settings. The set case must
12
+ # correspond to AIProviderKeySpec.provider. Providers with no settings (Anthropic,
13
+ # Gemini) simply leave this unset. The endpoint of a named provider is fixed and
14
+ # intentionally not overridable here; use the OpenAI-compatible provider to target
15
+ # a custom endpoint.
16
+ sig { returns(T.nilable(Cadenya::AIProviderKeySpec::Config)) }
17
+ attr_reader :config
15
18
 
16
- sig { params(api_key: String).void }
17
- attr_writer :api_key
19
+ sig { params(config: Cadenya::AIProviderKeySpec::Config::OrHash).void }
20
+ attr_writer :config
18
21
 
19
- # OpenRouterConfig holds OpenRouter-specific settings. Empty for now; it exists as
20
- # the oneof seam so provider-specific options (region, base URL, etc.) can be
21
- # added later without restructuring the spec.
22
- sig { returns(T.nilable(T.anything)) }
23
- attr_reader :openrouter
22
+ # AIProviderCredential is the secret material used to authenticate with a
23
+ # provider. The set case must correspond to AIProviderKeySpec.provider. The server
24
+ # encrypts the serialized message at rest and never returns it on reads.
25
+ sig { returns(T.nilable(Cadenya::AIProviderKeySpec::Credentials)) }
26
+ attr_reader :credentials
24
27
 
25
- sig { params(openrouter: T.anything).void }
26
- attr_writer :openrouter
28
+ sig do
29
+ params(
30
+ credentials: Cadenya::AIProviderKeySpec::Credentials::OrHash
31
+ ).void
32
+ end
33
+ attr_writer :credentials
27
34
 
28
35
  # The AI provider this key authenticates against.
29
36
  sig { returns(T.nilable(Cadenya::AIProviderKeySpec::Provider::OrSymbol)) }
@@ -36,19 +43,22 @@ module Cadenya
36
43
 
37
44
  sig do
38
45
  params(
39
- api_key: String,
40
- openrouter: T.anything,
46
+ config: Cadenya::AIProviderKeySpec::Config::OrHash,
47
+ credentials: Cadenya::AIProviderKeySpec::Credentials::OrHash,
41
48
  provider: Cadenya::AIProviderKeySpec::Provider::OrSymbol
42
49
  ).returns(T.attached_class)
43
50
  end
44
51
  def self.new(
45
- # The provider credential. Accepted on create/update; never populated in responses
46
- # (the server returns an empty value to avoid leaking it).
47
- api_key: nil,
48
- # OpenRouterConfig holds OpenRouter-specific settings. Empty for now; it exists as
49
- # the oneof seam so provider-specific options (region, base URL, etc.) can be
50
- # added later without restructuring the spec.
51
- openrouter: nil,
52
+ # AIProviderConfig holds non-secret, provider-specific settings. The set case must
53
+ # correspond to AIProviderKeySpec.provider. Providers with no settings (Anthropic,
54
+ # Gemini) simply leave this unset. The endpoint of a named provider is fixed and
55
+ # intentionally not overridable here; use the OpenAI-compatible provider to target
56
+ # a custom endpoint.
57
+ config: nil,
58
+ # AIProviderCredential is the secret material used to authenticate with a
59
+ # provider. The set case must correspond to AIProviderKeySpec.provider. The server
60
+ # encrypts the serialized message at rest and never returns it on reads.
61
+ credentials: nil,
52
62
  # The AI provider this key authenticates against.
53
63
  provider: nil
54
64
  )
@@ -57,8 +67,8 @@ module Cadenya
57
67
  sig do
58
68
  override.returns(
59
69
  {
60
- api_key: String,
61
- openrouter: T.anything,
70
+ config: Cadenya::AIProviderKeySpec::Config,
71
+ credentials: Cadenya::AIProviderKeySpec::Credentials,
62
72
  provider: Cadenya::AIProviderKeySpec::Provider::OrSymbol
63
73
  }
64
74
  )
@@ -66,6 +76,315 @@ module Cadenya
66
76
  def to_hash
67
77
  end
68
78
 
79
+ class Config < Cadenya::Internal::Type::BaseModel
80
+ OrHash =
81
+ T.type_alias do
82
+ T.any(
83
+ Cadenya::AIProviderKeySpec::Config,
84
+ Cadenya::Internal::AnyHash
85
+ )
86
+ end
87
+
88
+ # OpenAIConfig holds OpenAI-specific settings.
89
+ sig { returns(T.nilable(Cadenya::AIProviderKeySpec::Config::OpenAI)) }
90
+ attr_reader :openai
91
+
92
+ sig do
93
+ params(
94
+ openai: Cadenya::AIProviderKeySpec::Config::OpenAI::OrHash
95
+ ).void
96
+ end
97
+ attr_writer :openai
98
+
99
+ # OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
100
+ # Completions API. The base URL is required and its model catalog is discovered
101
+ # live via GET {base_url}/models.
102
+ sig do
103
+ returns(
104
+ T.nilable(Cadenya::AIProviderKeySpec::Config::OpenAICompatible)
105
+ )
106
+ end
107
+ attr_reader :openai_compatible
108
+
109
+ sig do
110
+ params(
111
+ openai_compatible:
112
+ Cadenya::AIProviderKeySpec::Config::OpenAICompatible::OrHash
113
+ ).void
114
+ end
115
+ attr_writer :openai_compatible
116
+
117
+ # OpenRouterConfig holds OpenRouter-specific settings.
118
+ sig do
119
+ returns(T.nilable(Cadenya::AIProviderKeySpec::Config::Openrouter))
120
+ end
121
+ attr_reader :openrouter
122
+
123
+ sig do
124
+ params(
125
+ openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter::OrHash
126
+ ).void
127
+ end
128
+ attr_writer :openrouter
129
+
130
+ # AIProviderConfig holds non-secret, provider-specific settings. The set case must
131
+ # correspond to AIProviderKeySpec.provider. Providers with no settings (Anthropic,
132
+ # Gemini) simply leave this unset. The endpoint of a named provider is fixed and
133
+ # intentionally not overridable here; use the OpenAI-compatible provider to target
134
+ # a custom endpoint.
135
+ sig do
136
+ params(
137
+ openai: Cadenya::AIProviderKeySpec::Config::OpenAI::OrHash,
138
+ openai_compatible:
139
+ Cadenya::AIProviderKeySpec::Config::OpenAICompatible::OrHash,
140
+ openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter::OrHash
141
+ ).returns(T.attached_class)
142
+ end
143
+ def self.new(
144
+ # OpenAIConfig holds OpenAI-specific settings.
145
+ openai: nil,
146
+ # OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
147
+ # Completions API. The base URL is required and its model catalog is discovered
148
+ # live via GET {base_url}/models.
149
+ openai_compatible: nil,
150
+ # OpenRouterConfig holds OpenRouter-specific settings.
151
+ openrouter: nil
152
+ )
153
+ end
154
+
155
+ sig do
156
+ override.returns(
157
+ {
158
+ openai: Cadenya::AIProviderKeySpec::Config::OpenAI,
159
+ openai_compatible:
160
+ Cadenya::AIProviderKeySpec::Config::OpenAICompatible,
161
+ openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter
162
+ }
163
+ )
164
+ end
165
+ def to_hash
166
+ end
167
+
168
+ class OpenAI < Cadenya::Internal::Type::BaseModel
169
+ OrHash =
170
+ T.type_alias do
171
+ T.any(
172
+ Cadenya::AIProviderKeySpec::Config::OpenAI,
173
+ Cadenya::Internal::AnyHash
174
+ )
175
+ end
176
+
177
+ # Sent as the OpenAI-Organization header when set.
178
+ sig { returns(T.nilable(String)) }
179
+ attr_reader :organization_id
180
+
181
+ sig { params(organization_id: String).void }
182
+ attr_writer :organization_id
183
+
184
+ # Sent as the OpenAI-Project header when set.
185
+ sig { returns(T.nilable(String)) }
186
+ attr_reader :project_id
187
+
188
+ sig { params(project_id: String).void }
189
+ attr_writer :project_id
190
+
191
+ # OpenAIConfig holds OpenAI-specific settings.
192
+ sig do
193
+ params(organization_id: String, project_id: String).returns(
194
+ T.attached_class
195
+ )
196
+ end
197
+ def self.new(
198
+ # Sent as the OpenAI-Organization header when set.
199
+ organization_id: nil,
200
+ # Sent as the OpenAI-Project header when set.
201
+ project_id: nil
202
+ )
203
+ end
204
+
205
+ sig do
206
+ override.returns({ organization_id: String, project_id: String })
207
+ end
208
+ def to_hash
209
+ end
210
+ end
211
+
212
+ class OpenAICompatible < Cadenya::Internal::Type::BaseModel
213
+ OrHash =
214
+ T.type_alias do
215
+ T.any(
216
+ Cadenya::AIProviderKeySpec::Config::OpenAICompatible,
217
+ Cadenya::Internal::AnyHash
218
+ )
219
+ end
220
+
221
+ sig { returns(T.nilable(String)) }
222
+ attr_reader :base_url
223
+
224
+ sig { params(base_url: String).void }
225
+ attr_writer :base_url
226
+
227
+ # OpenAICompatibleConfig configures a generic endpoint that speaks the OpenAI Chat
228
+ # Completions API. The base URL is required and its model catalog is discovered
229
+ # live via GET {base_url}/models.
230
+ sig { params(base_url: String).returns(T.attached_class) }
231
+ def self.new(base_url: nil)
232
+ end
233
+
234
+ sig { override.returns({ base_url: String }) }
235
+ def to_hash
236
+ end
237
+ end
238
+
239
+ class Openrouter < Cadenya::Internal::Type::BaseModel
240
+ OrHash =
241
+ T.type_alias do
242
+ T.any(
243
+ Cadenya::AIProviderKeySpec::Config::Openrouter,
244
+ Cadenya::Internal::AnyHash
245
+ )
246
+ end
247
+
248
+ # Data-residency region (e.g. "us", "eu"). Empty uses the provider default.
249
+ sig { returns(T.nilable(String)) }
250
+ attr_reader :region
251
+
252
+ sig { params(region: String).void }
253
+ attr_writer :region
254
+
255
+ # OpenRouterConfig holds OpenRouter-specific settings.
256
+ sig { params(region: String).returns(T.attached_class) }
257
+ def self.new(
258
+ # Data-residency region (e.g. "us", "eu"). Empty uses the provider default.
259
+ region: nil
260
+ )
261
+ end
262
+
263
+ sig { override.returns({ region: String }) }
264
+ def to_hash
265
+ end
266
+ end
267
+ end
268
+
269
+ class Credentials < Cadenya::Internal::Type::BaseModel
270
+ OrHash =
271
+ T.type_alias do
272
+ T.any(
273
+ Cadenya::AIProviderKeySpec::Credentials,
274
+ Cadenya::Internal::AnyHash
275
+ )
276
+ end
277
+
278
+ # CredentialAPIKey carries a single bearer/header API key.
279
+ sig do
280
+ returns(T.nilable(Cadenya::AIProviderKeySpec::Credentials::APIKey))
281
+ end
282
+ attr_reader :api_key
283
+
284
+ sig do
285
+ params(
286
+ api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey::OrHash
287
+ ).void
288
+ end
289
+ attr_writer :api_key
290
+
291
+ # CredentialHeaders carries arbitrary HTTP headers sent with every request to the
292
+ # provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
293
+ sig do
294
+ returns(T.nilable(Cadenya::AIProviderKeySpec::Credentials::Headers))
295
+ end
296
+ attr_reader :headers
297
+
298
+ sig do
299
+ params(
300
+ headers: Cadenya::AIProviderKeySpec::Credentials::Headers::OrHash
301
+ ).void
302
+ end
303
+ attr_writer :headers
304
+
305
+ # AIProviderCredential is the secret material used to authenticate with a
306
+ # provider. The set case must correspond to AIProviderKeySpec.provider. The server
307
+ # encrypts the serialized message at rest and never returns it on reads.
308
+ sig do
309
+ params(
310
+ api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey::OrHash,
311
+ headers: Cadenya::AIProviderKeySpec::Credentials::Headers::OrHash
312
+ ).returns(T.attached_class)
313
+ end
314
+ def self.new(
315
+ # CredentialAPIKey carries a single bearer/header API key.
316
+ api_key: nil,
317
+ # CredentialHeaders carries arbitrary HTTP headers sent with every request to the
318
+ # provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
319
+ headers: nil
320
+ )
321
+ end
322
+
323
+ sig do
324
+ override.returns(
325
+ {
326
+ api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey,
327
+ headers: Cadenya::AIProviderKeySpec::Credentials::Headers
328
+ }
329
+ )
330
+ end
331
+ def to_hash
332
+ end
333
+
334
+ class APIKey < Cadenya::Internal::Type::BaseModel
335
+ OrHash =
336
+ T.type_alias do
337
+ T.any(
338
+ Cadenya::AIProviderKeySpec::Credentials::APIKey,
339
+ Cadenya::Internal::AnyHash
340
+ )
341
+ end
342
+
343
+ sig { returns(T.nilable(String)) }
344
+ attr_reader :api_key
345
+
346
+ sig { params(api_key: String).void }
347
+ attr_writer :api_key
348
+
349
+ # CredentialAPIKey carries a single bearer/header API key.
350
+ sig { params(api_key: String).returns(T.attached_class) }
351
+ def self.new(api_key: nil)
352
+ end
353
+
354
+ sig { override.returns({ api_key: String }) }
355
+ def to_hash
356
+ end
357
+ end
358
+
359
+ class Headers < Cadenya::Internal::Type::BaseModel
360
+ OrHash =
361
+ T.type_alias do
362
+ T.any(
363
+ Cadenya::AIProviderKeySpec::Credentials::Headers,
364
+ Cadenya::Internal::AnyHash
365
+ )
366
+ end
367
+
368
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
369
+ attr_reader :headers
370
+
371
+ sig { params(headers: T::Hash[Symbol, String]).void }
372
+ attr_writer :headers
373
+
374
+ # CredentialHeaders carries arbitrary HTTP headers sent with every request to the
375
+ # provider (e.g. {"Authorization": "Bearer ...", "X-Api-Key": "..."}).
376
+ sig do
377
+ params(headers: T::Hash[Symbol, String]).returns(T.attached_class)
378
+ end
379
+ def self.new(headers: nil)
380
+ end
381
+
382
+ sig { override.returns({ headers: T::Hash[Symbol, String] }) }
383
+ def to_hash
384
+ end
385
+ end
386
+ end
387
+
69
388
  # The AI provider this key authenticates against.
70
389
  module Provider
71
390
  extend Cadenya::Internal::Type::Enum
@@ -84,6 +403,26 @@ module Cadenya
84
403
  :AI_PROVIDER_OPENROUTER,
85
404
  Cadenya::AIProviderKeySpec::Provider::TaggedSymbol
86
405
  )
406
+ AI_PROVIDER_OPENAI =
407
+ T.let(
408
+ :AI_PROVIDER_OPENAI,
409
+ Cadenya::AIProviderKeySpec::Provider::TaggedSymbol
410
+ )
411
+ AI_PROVIDER_ANTHROPIC =
412
+ T.let(
413
+ :AI_PROVIDER_ANTHROPIC,
414
+ Cadenya::AIProviderKeySpec::Provider::TaggedSymbol
415
+ )
416
+ AI_PROVIDER_GEMINI =
417
+ T.let(
418
+ :AI_PROVIDER_GEMINI,
419
+ Cadenya::AIProviderKeySpec::Provider::TaggedSymbol
420
+ )
421
+ AI_PROVIDER_OPENAI_COMPATIBLE =
422
+ T.let(
423
+ :AI_PROVIDER_OPENAI_COMPATIBLE,
424
+ Cadenya::AIProviderKeySpec::Provider::TaggedSymbol
425
+ )
87
426
 
88
427
  sig do
89
428
  override.returns(
@@ -2,19 +2,23 @@ module Cadenya
2
2
  module Models
3
3
  type ai_provider_key_spec =
4
4
  {
5
- api_key: String,
6
- openrouter: top,
5
+ config: Cadenya::AIProviderKeySpec::Config,
6
+ credentials: Cadenya::AIProviderKeySpec::Credentials,
7
7
  provider: Cadenya::Models::AIProviderKeySpec::provider
8
8
  }
9
9
 
10
10
  class AIProviderKeySpec < Cadenya::Internal::Type::BaseModel
11
- attr_reader api_key: String?
11
+ attr_reader config: Cadenya::AIProviderKeySpec::Config?
12
12
 
13
- def api_key=: (String) -> String
13
+ def config=: (
14
+ Cadenya::AIProviderKeySpec::Config
15
+ ) -> Cadenya::AIProviderKeySpec::Config
14
16
 
15
- attr_reader openrouter: top?
17
+ attr_reader credentials: Cadenya::AIProviderKeySpec::Credentials?
16
18
 
17
- def openrouter=: (top) -> top
19
+ def credentials=: (
20
+ Cadenya::AIProviderKeySpec::Credentials
21
+ ) -> Cadenya::AIProviderKeySpec::Credentials
18
22
 
19
23
  attr_reader provider: Cadenya::Models::AIProviderKeySpec::provider?
20
24
 
@@ -23,24 +27,170 @@ module Cadenya
23
27
  ) -> Cadenya::Models::AIProviderKeySpec::provider
24
28
 
25
29
  def initialize: (
26
- ?api_key: String,
27
- ?openrouter: top,
30
+ ?config: Cadenya::AIProviderKeySpec::Config,
31
+ ?credentials: Cadenya::AIProviderKeySpec::Credentials,
28
32
  ?provider: Cadenya::Models::AIProviderKeySpec::provider
29
33
  ) -> void
30
34
 
31
35
  def to_hash: -> {
32
- api_key: String,
33
- openrouter: top,
36
+ config: Cadenya::AIProviderKeySpec::Config,
37
+ credentials: Cadenya::AIProviderKeySpec::Credentials,
34
38
  provider: Cadenya::Models::AIProviderKeySpec::provider
35
39
  }
36
40
 
37
- type provider = :AI_PROVIDER_UNSPECIFIED | :AI_PROVIDER_OPENROUTER
41
+ type config =
42
+ {
43
+ openai: Cadenya::AIProviderKeySpec::Config::OpenAI,
44
+ openai_compatible: Cadenya::AIProviderKeySpec::Config::OpenAICompatible,
45
+ openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter
46
+ }
47
+
48
+ class Config < Cadenya::Internal::Type::BaseModel
49
+ attr_reader openai: Cadenya::AIProviderKeySpec::Config::OpenAI?
50
+
51
+ def openai=: (
52
+ Cadenya::AIProviderKeySpec::Config::OpenAI
53
+ ) -> Cadenya::AIProviderKeySpec::Config::OpenAI
54
+
55
+ attr_reader openai_compatible: Cadenya::AIProviderKeySpec::Config::OpenAICompatible?
56
+
57
+ def openai_compatible=: (
58
+ Cadenya::AIProviderKeySpec::Config::OpenAICompatible
59
+ ) -> Cadenya::AIProviderKeySpec::Config::OpenAICompatible
60
+
61
+ attr_reader openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter?
62
+
63
+ def openrouter=: (
64
+ Cadenya::AIProviderKeySpec::Config::Openrouter
65
+ ) -> Cadenya::AIProviderKeySpec::Config::Openrouter
66
+
67
+ def initialize: (
68
+ ?openai: Cadenya::AIProviderKeySpec::Config::OpenAI,
69
+ ?openai_compatible: Cadenya::AIProviderKeySpec::Config::OpenAICompatible,
70
+ ?openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter
71
+ ) -> void
72
+
73
+ def to_hash: -> {
74
+ openai: Cadenya::AIProviderKeySpec::Config::OpenAI,
75
+ openai_compatible: Cadenya::AIProviderKeySpec::Config::OpenAICompatible,
76
+ openrouter: Cadenya::AIProviderKeySpec::Config::Openrouter
77
+ }
78
+
79
+ type openai = { organization_id: String, project_id: String }
80
+
81
+ class OpenAI < Cadenya::Internal::Type::BaseModel
82
+ attr_reader organization_id: String?
83
+
84
+ def organization_id=: (String) -> String
85
+
86
+ attr_reader project_id: String?
87
+
88
+ def project_id=: (String) -> String
89
+
90
+ def initialize: (
91
+ ?organization_id: String,
92
+ ?project_id: String
93
+ ) -> void
94
+
95
+ def to_hash: -> { organization_id: String, project_id: String }
96
+ end
97
+
98
+ type openai_compatible = { base_url: String }
99
+
100
+ class OpenAICompatible < Cadenya::Internal::Type::BaseModel
101
+ attr_reader base_url: String?
102
+
103
+ def base_url=: (String) -> String
104
+
105
+ def initialize: (?base_url: String) -> void
106
+
107
+ def to_hash: -> { base_url: String }
108
+ end
109
+
110
+ type openrouter = { region: String }
111
+
112
+ class Openrouter < Cadenya::Internal::Type::BaseModel
113
+ attr_reader region: String?
114
+
115
+ def region=: (String) -> String
116
+
117
+ def initialize: (?region: String) -> void
118
+
119
+ def to_hash: -> { region: String }
120
+ end
121
+ end
122
+
123
+ type credentials =
124
+ {
125
+ api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey,
126
+ headers: Cadenya::AIProviderKeySpec::Credentials::Headers
127
+ }
128
+
129
+ class Credentials < Cadenya::Internal::Type::BaseModel
130
+ attr_reader api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey?
131
+
132
+ def api_key=: (
133
+ Cadenya::AIProviderKeySpec::Credentials::APIKey
134
+ ) -> Cadenya::AIProviderKeySpec::Credentials::APIKey
135
+
136
+ attr_reader headers: Cadenya::AIProviderKeySpec::Credentials::Headers?
137
+
138
+ def headers=: (
139
+ Cadenya::AIProviderKeySpec::Credentials::Headers
140
+ ) -> Cadenya::AIProviderKeySpec::Credentials::Headers
141
+
142
+ def initialize: (
143
+ ?api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey,
144
+ ?headers: Cadenya::AIProviderKeySpec::Credentials::Headers
145
+ ) -> void
146
+
147
+ def to_hash: -> {
148
+ api_key: Cadenya::AIProviderKeySpec::Credentials::APIKey,
149
+ headers: Cadenya::AIProviderKeySpec::Credentials::Headers
150
+ }
151
+
152
+ type api_key = { api_key: String }
153
+
154
+ class APIKey < Cadenya::Internal::Type::BaseModel
155
+ attr_reader api_key: String?
156
+
157
+ def api_key=: (String) -> String
158
+
159
+ def initialize: (?api_key: String) -> void
160
+
161
+ def to_hash: -> { api_key: String }
162
+ end
163
+
164
+ type headers = { headers: ::Hash[Symbol, String] }
165
+
166
+ class Headers < Cadenya::Internal::Type::BaseModel
167
+ attr_reader headers: ::Hash[Symbol, String]?
168
+
169
+ def headers=: (::Hash[Symbol, String]) -> ::Hash[Symbol, String]
170
+
171
+ def initialize: (?headers: ::Hash[Symbol, String]) -> void
172
+
173
+ def to_hash: -> { headers: ::Hash[Symbol, String] }
174
+ end
175
+ end
176
+
177
+ type provider =
178
+ :AI_PROVIDER_UNSPECIFIED
179
+ | :AI_PROVIDER_OPENROUTER
180
+ | :AI_PROVIDER_OPENAI
181
+ | :AI_PROVIDER_ANTHROPIC
182
+ | :AI_PROVIDER_GEMINI
183
+ | :AI_PROVIDER_OPENAI_COMPATIBLE
38
184
 
39
185
  module Provider
40
186
  extend Cadenya::Internal::Type::Enum
41
187
 
42
188
  AI_PROVIDER_UNSPECIFIED: :AI_PROVIDER_UNSPECIFIED
43
189
  AI_PROVIDER_OPENROUTER: :AI_PROVIDER_OPENROUTER
190
+ AI_PROVIDER_OPENAI: :AI_PROVIDER_OPENAI
191
+ AI_PROVIDER_ANTHROPIC: :AI_PROVIDER_ANTHROPIC
192
+ AI_PROVIDER_GEMINI: :AI_PROVIDER_GEMINI
193
+ AI_PROVIDER_OPENAI_COMPATIBLE: :AI_PROVIDER_OPENAI_COMPATIBLE
44
194
 
45
195
  def self?.values: -> ::Array[Cadenya::Models::AIProviderKeySpec::provider]
46
196
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cadenya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cadenya