WatsonXConfig

org.llm4s.llmconnect.config.WatsonXConfig
See theWatsonXConfig companion object
final case class WatsonXConfig(apiKey: Secret, projectId: String, spaceId: Option[String], model: String, baseUrl: String, apiVersion: String, iamUrl: String, contextWindow: Int, reserveCompletion: Int, timeouts: ProviderTimeouts, network: HttpNetworkSettings, apiKeyProvider: Option[ApiKeyProvider]) extends ProviderConfig

Configuration for IBM watsonx.ai.

watsonx.ai hosts IBM Granite, Llama, Mistral and other models behind a governed API. Auth is IBM Cloud IAM: the apiKey is exchanged for a short-lived bearer token. Inference runs in a project (projectId) or a deployment space (spaceId); setting both is rejected. Prefer WatsonXConfig.fromValues over the primary constructor.

Value parameters

apiKey

IBM Cloud API key exchanged for IAM bearer tokens; redacted in toString.

apiKeyProvider

asked for the API key on every request instead of exchanging apiKey, so a rotated key is exchanged for a new IAM token without rebuilding the client (#2477): a section's apiKeyFile sets one.

apiVersion

watsonx API version date sent as the version query parameter, e.g. "2026-09-25".

baseUrl

watsonx.ai ML API base URL, e.g. "https://us-south.ml.cloud.ibm.com".

contextWindow

Model's total token capacity (prompt + completion combined).

iamUrl

IBM Cloud IAM token endpoint.

model

Model identifier, e.g. "ibm/granite-4-h-small".

projectId

watsonx project ID; may be empty only when spaceId is set.

reserveCompletion

Tokens held back from prompt history for the completion.

spaceId

Optional watsonx deployment space ID, used in place of the project (never together with it).

timeouts

how long a request and a stream may take: the section's timeouts block. An absent value keeps the client's own default (ProviderTimeouts).

Attributes

Companion
object
Source
WatsonXConfig.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def endpointUrl: Option[String]

The endpoint this config will contact, when it is known statically.

The endpoint this config will contact, when it is known statically.

Used by policy checks and diagnostics that need to know where traffic will go without knowing which provider it belongs to. None means the config carries no single URL — not that it makes no network calls.

Attributes

Definition Classes
Source
WatsonXConfig.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
WatsonXConfig.scala

The same config, its client asking provider for the key on each request, so a rotated key is used without rebuilding the client.

The same config, its client asking provider for the key on each request, so a rotated key is used without rebuilding the client.

The loader calls this for a section that sets apiKeyFile. The default returns this: a config whose client cannot take a provider ignores it, and its apiKeyProvider stays None - which the loader reports as an error for apiKeyFile and code setting a provider should check. A config that supports it overrides this with its own return type.

Attributes

Definition Classes
Source
WatsonXConfig.scala
override def withModel(model: String): WatsonXConfig

The same provider and credentials, pointed at a different model.

The same provider and credentials, pointed at a different model.

Attributes

Definition Classes
Source
WatsonXConfig.scala

The same config with the given proxy and TLS settings.

The same config with the given proxy and TLS settings.

The loader calls this on every config a descriptor builds, as it does withTimeouts, so a descriptor does not read the http block itself. The default returns this: a config that does not carry the setting ignores it. A config that does overrides this with its own return type.

Attributes

Definition Classes
Source
WatsonXConfig.scala
override def withTimeouts(timeouts: ProviderTimeouts): WatsonXConfig

The same config with the given timeouts.

The same config with the given timeouts.

The loader calls this on every config a descriptor builds, passing the section's timeouts block, so a descriptor does not read the block itself. The default returns this: a config that does not carry timeouts, such as one supplied by another module, ignores them. A config that does overrides this with its own return type.

Attributes

Definition Classes
Source
WatsonXConfig.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Concrete fields

override val providerId: ProviderId

Canonical id of the provider this config addresses, e.g. ProviderId("openai").

Canonical id of the provider this config addresses, e.g. ProviderId("openai").

Attributes

Source
WatsonXConfig.scala