Overview
The OpenAI provider enables ZeroClaw to use GPT models and reasoning models via the OpenAI API. Provider ID:openai
Base URL: https://api.openai.com/v1
API Version: Latest stable
Authentication
Environment Variables
Credentials are resolved in the following order:OPENAI_API_KEY- OpenAI API key- Generic fallback:
ZEROCLAW_API_KEYorAPI_KEY
API Key Format
Standard API keys use the formatsk-*:
Configuration
Config File
Custom Base URL
For compatible endpoints:Max Tokens Override
Optional per-provider override:Features
Native Tool Calling
Supported: Yes The provider uses OpenAI’s native function calling format:Vision Support
Supported: Yes (model-dependent) Vision models likegpt-4o support image inputs. ZeroClaw does not currently parse inline images for OpenAI (vision support via multimodal normalization is provider-specific).
Reasoning Models
Supported: Yes Reasoning models (e.g.,o1, o1-mini) return output in reasoning_content field:
content→ primary responsereasoning_content→ fallback ifcontentis empty
Token Usage Tracking
Supported: Yes Usage data is extracted from response:TokenUsage:
API Endpoints
Chat Completion
Endpoint:POST /chat/completions
Request:
Models Endpoint
Endpoint:GET /models
Used for warmup:
Request Configuration
Max Tokens
Default: Not set (uses model default) Override: Optional viamax_tokens_override
Temperature
Range: 0.0 - 2.0 Default: 0.7 (from config) Controls response randomness.Timeouts
- Request timeout: 120 seconds
- Connection timeout: 10 seconds
Message Format
System Prompt
Sent as a message with rolesystem:
User Messages
Simple text:Assistant Messages
Text only:Tool Messages
Tool results:Tool Call Conversion
ZeroClaw’s internal tool format is converted to OpenAI format: ZeroClaw internal:Stop Reasons
Normalized stop reasons:| OpenAI | ZeroClaw Normalized |
|---|---|
stop | EndTurn |
length | MaxTokens |
tool_calls | ToolUse |
content_filter | ContentFilter |
Error Handling
Authentication Errors
OPENAI_API_KEY.
Invalid Tool Specification
Strict validation for tool definitions:type: "function"function.name(string)function.description(string, can be empty)function.parameters(object)
API Errors
Error responses are sanitized before display:Provider Capabilities
gpt-4o).
Warmup
Supported: Yes Warmup calls the/models endpoint:
Example Usage
Simple Chat
With Tools
Reasoning Model
Reasoning Content Handling
Reasoning models may return:Limitations
- Max tokens override is optional (not all requests use it)
- Vision support is model-dependent (not auto-detected)
- Reasoning content pass-through in multi-turn history
- Tool validation is strict (malformed tools are rejected)