Skip to content

Commit fe1dce6

Browse files
committed
updated readme
1 parent bbbf3fe commit fe1dce6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,12 +713,27 @@ If bundler is not being used to manage dependencies, install the gem by executin
713713

714714
If you are using the default OpenRouter API, Raix expects `Raix.configuration.openrouter_client` to initialized with the OpenRouter API client instance.
715715

716-
You can add an initializer to your application's `config/initializers` directory:
716+
You can add an initializer to your application's `config/initializers` directory that looks like this example (setting up both providers, OpenRouter and OpenAI):
717717

718718
```ruby
719719
# config/initializers/raix.rb
720+
OpenRouter.configure do |config|
721+
config.faraday do |f|
722+
f.request :retry, retry_options
723+
f.response :logger, Logger.new($stdout), { headers: true, bodies: true, errors: true } do |logger|
724+
logger.filter(/(Bearer) (\S+)/, '\1[REDACTED]')
725+
end
726+
end
727+
end
728+
720729
Raix.configure do |config|
721-
config.openrouter_client = OpenRouter::Client.new
730+
config.openrouter_client = OpenRouter::Client.new(access_token: ENV.fetch("OR_ACCESS_TOKEN", nil))
731+
config.openai_client = OpenAI::Client.new(access_token: ENV.fetch("OAI_ACCESS_TOKEN", nil)) do |f|
732+
f.request :retry, retry_options
733+
f.response :logger, Logger.new($stdout), { headers: true, bodies: true, errors: true } do |logger|
734+
logger.filter(/(Bearer) (\S+)/, '\1[REDACTED]')
735+
end
736+
end
722737
end
723738
```
724739

0 commit comments

Comments
 (0)