mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
Add headers to client
This commit is contained in:
@ -6,7 +6,7 @@ use std::env;
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let api_key = env::var("OPENROUTER_API_KEY").unwrap().to_string();
|
||||
let client = OpenAIClient::builder()
|
||||
let mut client = OpenAIClient::builder()
|
||||
.with_endpoint("https://openrouter.ai/api/v1")
|
||||
.with_api_key(api_key)
|
||||
.build()?;
|
||||
@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let result = client.chat_completion(req).await?;
|
||||
println!("Content: {:?}", result.choices[0].message.content);
|
||||
println!("Response Headers: {:?}", result.headers);
|
||||
println!("Response Headers: {:?}", client.headers);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user