> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Completions

> Send OpenAI-compatible Chat Completions requests with the Rust SDK.

Use `chat_completions(...)` when an existing integration already uses message-based Chat Completions payloads.

```rust theme={null}
use phaseo::Phaseo;
use serde_json::json;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Phaseo::from_env()?;
    let response = client.chat_completions(&json!({
        "model": "openai/gpt-5.6-sol",
        "messages": [
            {
                "role": "system",
                "content": "Answer concisely."
            },
            {
                "role": "user",
                "content": "What is provider fallback?"
            }
        ]
    }))?;

    let text = response
        .body
        .pointer("/choices/0/message/content")
        .and_then(|value| value.as_str())
        .unwrap_or("");

    println!("{text}");
    Ok(())
}
```

For new integrations, prefer the [Responses API](./responses). It provides one request model for text, multimodal input, tools, and richer output items.

## Related

* [Chat Completions API reference](../../api-reference/endpoint/chat-completions)
* [Rust API reference](./api-reference)
