"""Provider module exports."""

from nanobot.providers.base import LLMProvider, LLMResponse, ToolCallRequest
from nanobot.providers.litellm_provider import LiteLLMProvider
from nanobot.providers.openai_codex_provider import OpenAICodexProvider
from nanobot.providers.anthropic_oauth import AnthropicOAuthProvider
from nanobot.providers.registry import should_use_oauth_provider

__all__ = [
    "LLMProvider",
    "LLMResponse",
    "ToolCallRequest",
    "LiteLLMProvider",
    "OpenAICodexProvider",
    "AnthropicOAuthProvider",
    "create_provider",
]


def create_provider(
    api_key: str,
    model: str,
    api_base: str | None = None,
    extra_headers: dict[str, str] | None = None,
    provider_name: str | None = None,
    thinking_budget: int = 0,
) -> LLMProvider:
    """Factory function to create appropriate provider.

    Automatically selects AnthropicOAuthProvider for OAuth tokens,
    LiteLLMProvider for everything else.
    """
    if should_use_oauth_provider(api_key, model):
        return AnthropicOAuthProvider(
            oauth_token=api_key,
            default_model=model,
            api_base=api_base,
            thinking_budget=thinking_budget,
        )

    return LiteLLMProvider(
        api_key=api_key,
        api_base=api_base,
        default_model=model,
        extra_headers=extra_headers,
        provider_name=provider_name,
    )
