When to Use OpenAI-Compatible Endpoint
The OpenAI-compatible API is ideal when:- You’re migrating from OpenAI and want minimal code changes
- You’re using frameworks built for OpenAI (LangChain, LlamaIndex, Vercel AI SDK)
- You want a simple chat interface for browser automation
- You need streaming responses
- You prefer the familiar OpenAI SDK patterns
- Multi-task sessions with persistent browser state
- Manual browser control and takeover
- Video streaming
- Fine-grained session management
The OpenAI-compatible endpoint creates a new session for each request and auto-terminates after completion. For multi-task workflows, use the native REST API.
Setup with OpenAI SDK
Installation
Basic Usage
Framework Examples
LangChain
LlamaIndex
Vercel AI SDK
Chat Completions Format
Request Format
Non-Streaming Response
Streaming Response
Whenstream: true, responses use Server-Sent Events (SSE):
Available Models
Currently, only
webrun-browser-1 is available. Additional models may be added in the future.Differences from Standard OpenAI API
Supported Features
- Chat completions endpoint
- Streaming responses
- Message history
- System messages
- Token usage reporting
Not Supported
- Function calling (use native REST API for manual control)
- Vision (images in messages)
- Tool use (use native REST API for multi-task workflows)
- Fine-tuning
- Embeddings
- Moderation
- Audio/Speech
- Temperature/top_p (task execution is deterministic)
Different Behavior
1. Session Management- OpenAI: Stateless, each request is independent
- WebRun: Each request creates a new browser session that auto-terminates
- OpenAI: Typically 1-5 seconds
- WebRun: Typically 10-50 seconds (real browser automation)
- OpenAI: Based on model (e.g., 128k tokens)
- WebRun: Task-focused, less emphasis on large context
- OpenAI: Per-token pricing
- WebRun: Per-task pricing with token usage included in response
Limitations
Multi-Task Workflows
The OpenAI-compatible endpoint creates a new session per request. For multi-step workflows, use the native REST API:Guardrails
Guardrails (human-in-the-loop) are not supported via OpenAI-compatible endpoint. If a guardrail triggers, the request will fail:Video Streaming
Live video streaming is not available via OpenAI-compatible endpoint. Use native REST API to getwebRTCURL and webViewURL.