Function send_completion_request

Source
pub async fn send_completion_request(
    base_url: &str,
    api_key: &str,
    x_title: &Option<String>,
    http_referer: &Option<String>,
    request: &CompletionRequest,
) -> Result<CompletionsResponse, OpenRouterError>
Expand description

Send a completion request to a selected model (text-only format)

§Arguments

  • base_url - The API URL for the request.
  • api_key - The API key for authentication.
  • x_title - The name of the site for the request.
  • http_referer - The URL of the site for the request.
  • request - The completion request containing the model, prompt, and other optional parameters.

§Returns

  • Result<CompletionsResponse, OpenRouterError> - The response from the completion request, containing the generated text and other details.