pub async fn invoke(
client: &Client,
base_url: &str,
api_key: &str,
extra_headers: &[(String, String)],
upstream_model: &str,
default_max_tokens: Option<u64>,
request: CompletionRequest,
) -> Result<ModelStream, CompletionError>Expand description
Stream one completion from an OpenAI-compatible endpoint.
§Errors
Returns CompletionError::provider when the endpoint rejects the
request (with the provider’s retry classification) and
CompletionError::ResponseError when a live stream breaks mid-flight.
Individual stream items may also yield errors.