use crimson_crab::model_ids::CLAUDE_OPUS_4_8;
use crimson_crab::prelude::*;
use crimson_crab::types::ContentBlock;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::from_env()?;
let request = MessagesRequest::builder()
.model(CLAUDE_OPUS_4_8)
.max_tokens(4096)
.thinking(ThinkingConfig::adaptive_with_display(
ThinkingDisplay::Summarized,
))
.output_config(OutputConfig {
effort: Some(Effort::High),
format: None,
})
.messages(vec![MessageParam::user(
"A bat and a ball cost $1.10 total. The bat costs $1.00 more than \
the ball. How much does the ball cost? Explain briefly.",
)])
.build()?;
let message = client.messages().create(&request).await?;
for block in &message.content {
match block {
ContentBlock::Thinking(thinking) => {
println!("--- thinking ---\n{}\n", thinking.thinking);
}
ContentBlock::Text(text) => {
println!("--- answer ---\n{}", text.text);
}
_ => {}
}
}
Ok(())
}