Skip to main content

self_hosted

Function self_hosted 

Source
pub fn self_hosted(
    base_url: &str,
    model: &str,
) -> Result<OpenAiClient, ApiError>
Expand description

Self-hosted client — an OpenAiClient pointed at any custom endpoint.

Use this for vLLM, LM Studio, text-generation-inference, or any other server that exposes an OpenAI-compatible API.

For servers that require an API key, set it via the OPENAI_API_KEY environment variable or use OpenAiClient::builder directly.

§Example

use loopctl::provider;

let client = provider::self_hosted("http://localhost:8080/v1", "my-model")?;

§Errors

Returns ApiError if the HTTP client cannot be built.