Skip to content

Conversation

@arpagon
Copy link

@arpagon arpagon commented Nov 2, 2025

Summary

This PR adds support for configuring Azure OpenAI settings through crwl config, eliminating the need to manually set environment variables before each command.

Changes

  • Added AZURE_API_BASE configuration setting to USER_SETTINGS in config.py
  • Added AZURE_API_VERSION configuration setting to USER_SETTINGS in config.py
  • Updated setup_llm_config() in cli.py to export Azure environment variables from the global configuration

Motivation

Currently, when using Azure OpenAI with crawl4ai, users must export AZURE_API_BASE and AZURE_API_VERSION environment variables before running each command:

AZURE_API_BASE="https://your-resource.openai.azure.com" \
AZURE_API_VERSION="2024-08-01-preview" \
crwl https://example.com -q "What is this about?"

This is inconvenient and error-prone. With this PR, users can configure these settings once:

crwl config set AZURE_API_BASE "https://your-resource.openai.azure.com"
crwl config set AZURE_API_VERSION "2024-08-01-preview"
crwl config set DEFAULT_LLM_PROVIDER "azure/gpt-5"

And then use crawl4ai with Azure OpenAI without any environment variables:

crwl https://example.com -q "What is this about?"

Testing

Tested locally with Azure OpenAI GPT-5 deployment:

  • Configured Azure settings via crwl config set
  • Verified settings are stored in ~/.crawl4ai/global.yml
  • Successfully ran crwl commands without setting environment variables
  • Confirmed LiteLLM received the Azure environment variables correctly

Implementation Details

The setup_llm_config() function now reads AZURE_API_BASE and AZURE_API_VERSION from the global configuration and exports them as environment variables before LiteLLM is called. This ensures backward compatibility while providing a better user experience.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

Add AZURE_API_BASE and AZURE_API_VERSION configuration options to allow
users to configure Azure OpenAI settings through `crwl config` instead
of requiring environment variables to be set manually.

Changes:
- Add AZURE_API_BASE setting to USER_SETTINGS in config.py
- Add AZURE_API_VERSION setting to USER_SETTINGS in config.py
- Update setup_llm_config() in cli.py to export Azure env vars from config
- Users can now set Azure settings with:
  crwl config set AZURE_API_BASE "https://your-resource.openai.azure.com"
  crwl config set AZURE_API_VERSION "2024-08-01-preview"

This improves the user experience for Azure OpenAI users by eliminating
the need to export environment variables before each crwl command.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant