OpenrouterSdk.Auth (OpenRouter SDK v0.1.0)

Copy Markdown View Source

build the headers that authenticate a request.

the api key may come from %Config{} or be overridden per call (the oauth flow returns a per-user key — consumers pass it via opts).

Summary

Functions

produce the request headers for an authenticated call. returns {:ok, headers} or {:error, %Error{}} if no api key is available.

Functions

headers(config)

@spec headers(OpenrouterSdk.Config.t()) ::
  {:ok, [{String.t(), String.t()}]} | {:error, OpenrouterSdk.Error.t()}

produce the request headers for an authenticated call. returns {:ok, headers} or {:error, %Error{}} if no api key is available.