infusion_runtime

The runtime shared by every Elixir SDK generated with Infusion.

You don't use this package directly: an SDK generated by Infusion depends on it, and its generated functions hand each API call to it. Keeping this code out of the generated SDKs means a fix here reaches every SDK, and the generated code stays short and readable.

What it does, built on Req:

Configuration

Settings come from the SDK's defaults, then your config, then the call:

config :openai_sdk, api_key: System.fetch_env!("OPENAI_API_KEY"), max_retries: 5

OpenAI.Models.list(timeout: 5_000)

See Infusion.Runtime.Config for every setting.

Testing

Point an SDK at a Req.Test stub:

# config/test.exs
config :openai_sdk, req_options: [plug: {Req.Test, OpenAI}]

License

Apache 2.0