You already have a Rust client built on async-openai.
Wren R1 speaks the same OpenAI-compatible protocol, so you change where
the client points and which model it asks for. Nothing else in your
request code changes.
Add the crate:
[dependencies]
async-openai = { version = "0.42", features = ["chat-completion"] }
tokio = { version = "1", features = ["full"] } The crate reads the standard environment variables, so the smallest change is two exports:
export OPENAI_BASE_URL=https://webwright.ai/v1
export OPENAI_API_KEY=your-webwright-key Then a stock client and one chat request:
use async_openai::{
types::chat::{ChatCompletionRequestUserMessage, CreateChatCompletionRequestArgs},
Client,
};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let request = CreateChatCompletionRequestArgs::default()
.model("wren-r1")
.messages([ChatCompletionRequestUserMessage::from("Say this is a test").into()])
.build()?;
let response = client.chat().create(request).await?;
for choice in response.choices {
if let Some(content) = choice.message.content {
println!("{content}");
}
}
Ok(())
} If you would rather keep the configuration in code, build the client
from OpenAIConfig instead:
use async_openai::{config::OpenAIConfig, Client};
let config = OpenAIConfig::default()
.with_api_base("https://webwright.ai/v1")
.with_api_key(std::env::var("WEBWRIGHT_API_KEY")?);
let client = Client::with_config(config); The two changes that matter are the base URL https://webwright.ai/v1 and the model wren-r1. Your existing message building, streaming and
response handling stay as they are.
What Wren R1 serves
- One base URL,
https://webwright.ai/v1, covers chat completions and audio transcription. - Chat model:
wren-r1, with a 200K token context window. - Published Standard rates: cache $0.10, input $0.40, output $1.60 per 1M tokens.
If you are weighing a second provider or planning a migration, a short call is the fastest way to get a prioritized first use case.
The WebWright Team