Why OpenAI Compatibility?
The OpenAI Chat Completions API has become the de facto standard for AI applications. By implementing this same interface, Vizra ADK instantly becomes compatible with thousands of existing tools, libraries, and workflows without any code changes.Existing Tools
Use with LangChain, LlamaIndex, Vercel AI SDK, and countless other libraries
Client Apps
Works with ChatGPT clients, mobile apps, browser extensions, and desktop tools
Zero Migration
Just change the base URL - everything else works exactly the same
API Endpoint
OpenAI Compatible Endpoint
Quick Start
Ready to try it? Here are examples in different languages:- cURL
- Laravel Http
- JavaScript
- Python
Terminal
Using with Existing Libraries
- OpenAI SDK (Python)
- LangChain
Configuration
Configure model-to-agent mapping to make your agents accessible via familiar OpenAI model names:config/vizra-adk.php
How Model Resolution Works:
- First checks for exact match in
openai_model_mapping - If model starts with
gpt-, usesdefault_chat_agent - Otherwise, treats the model name as the agent name directly
model: "your_agent_name" directly without any mapping.php artisan vendor:publish --tag=vizra-adk-config.
Streaming Support
Enable real-time streaming responses by setting"stream": true in your request:
- JavaScript
- Python
Supported Parameters
The OpenAI compatibility layer supports all major ChatGPT parameters:| Parameter | Description |
|---|---|
model | Agent name or mapped model name |
messages | Array of conversation messages |
stream | Enable streaming responses |
temperature | Creativity level (0.0 - 2.0) |
max_tokens | Maximum response length |
top_p | Nucleus sampling parameter |
user | User identifier for sessions |
Response Format
Responses match OpenAI’s format exactly, ensuring perfect compatibility:Standard Response
Non-streaming Response
Streaming Response
Server-Sent Events Format
Error Handling
Error responses also match OpenAI’s format for seamless compatibility:Error Response Format
| Status Code | Description |
|---|---|
| 400 - Bad Request | Invalid request format or missing required fields |
| 404 - Not Found | Agent/model not found or not registered |
| 500 - Server Error | Internal error during agent execution |
Tips & Best Practices
Agent Naming Strategy
Map commonly used OpenAI model names to your best agents to make migration seamless. For example, map
gpt-4 to your most advanced agent.Performance Optimization
Use the
user parameter to maintain persistent sessions and memory across conversations for more personalized responses.Development Workflow
Test your OpenAI compatibility with existing tools during development. Most AI applications allow changing the base URL for easy integration testing.
Direct Agent Access
You can use
model: "your_agent_name" directly without any mapping configuration.