Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ client = OpenAI::Client.new(access_token: "access_token_goes_here", admin_token:
#### Custom timeout or base URI

- The default timeout for any request using this library is 120 seconds. You can change that by passing a number of seconds to the `request_timeout` when initializing the client.
- You can also change the base URI used for all requests, eg. to use observability tools like [Helicone](https://docs.helicone.ai/quickstart/integrate-in-one-line-of-code) or [Velvet](https://docs.usevelvet.com/docs/getting-started)
- You can also change the base URI used for all requests, eg. to use local inference servers, OpenAI-compatible gateways, or observability tools like [Helicone](https://docs.helicone.ai/quickstart/integrate-in-one-line-of-code) or [Velvet](https://docs.usevelvet.com/docs/getting-started)
- You can also add arbitrary other headers e.g. for [openai-caching-proxy-worker](https://github.com/6/openai-caching-proxy-worker), eg.:

```ruby
Expand All @@ -203,6 +203,17 @@ client = OpenAI::Client.new(
)
```

For applications that need to switch between OpenAI and an OpenAI-compatible
endpoint in different environments, a common pattern is to read the base URI
from `OPENAI_BASE_URL`:

```ruby
client = OpenAI::Client.new(
access_token: ENV.fetch("OPENAI_ACCESS_TOKEN"),
uri_base: ENV.fetch("OPENAI_BASE_URL", "https://api.openai.com/")
)
```

or when configuring the gem:

```ruby
Expand Down