| 18 | |
| 19 | impl ApiClient { |
| 20 | pub fn new(base_url: &str, api_key: &str) -> Result<Self> { |
| 21 | let client = reqwest::blocking::Client::builder() |
| 22 | .timeout(std::time::Duration::from_secs(120)) |
| 23 | .build() |
| 24 | .context("failed to build HTTP client")?; |
| 25 | Ok(Self { |
| 26 | client, |
| 27 | base_url: base_url.trim_end_matches('/').to_string(), |
| 28 | api_key: api_key.to_string(), |
| 29 | }) |
| 30 | } |
| 31 | |
| 32 | /// Build from environment variables `LLM_BENCHMARK_UPLOAD_URL` and `LLM_BENCHMARK_API_KEY`. |
| 33 | /// Returns `None` if `LLM_BENCHMARK_UPLOAD_URL` is not set. |