Why Choose LaoZhang API?
LaoZhang API is a unified AI API gateway that provides seamless access to 200+ AI models through a single OpenAI-compatible interface. Access GPT-5.6, Claude Sonnet 5, Gemini 3.6 Flash, DeepSeek V4, and more with one API key.Platform Features
OpenAI Compatible Mode
LaoZhang API uses OpenAI-compatible format, allowing you to easily call GPT, Claude, and 200+ AI models through a unified interface: Supported Model Providers:- 🤖 OpenAI: gpt-5.6, gpt-5.6-terra, gpt-5.6-luna, gpt-5.1-codex, etc.
- 🧠 Anthropic: claude-sonnet-5, claude-opus-4-8, claude-fable-5, etc.
- 💎 Google: gemini-3.6-flash, gemini-3.5-flash-lite, gemini-3.1-pro-preview, etc.
- 🚀 xAI: grok-4.5, grok-4.3, Grok 4.20 series, etc.
- 🔍 DeepSeek: deepseek-v4-pro, deepseek-v4-flash, etc.
- 🌟 Alibaba: Qwen series models
- 💬 Moonshot: Kimi models, etc.
Availability depends on the account, token group, and current route. Before production use, confirm the exact model ID, live gateway price, and access status on the console model and pricing page.
Feature Support
✅ Supported Features:- 💬 Chat Completions: Chat Completions interface
- 🖼️ Image Generation: gpt-image-2, flux-kontext-pro, flux-kontext-max, etc.
- 🔊 Audio Processing: Whisper transcription
- 📊 Embeddings: Text vectorization
- ⚡ Function Calling: Function Calling
- 📡 Streaming: Real-time responses
- 🔧 OpenAI Parameters: temperature, top_p, max_tokens, etc.
- 🆕 Responses Endpoint: Latest OpenAI features
- 🔧 Fine-tuning interface
- 📁 Files management interface
- 🏢 Organization management interface
- 💳 Billing management interface
Easy Model Switching
Core Advantage: One Codebase, Multiple Models After running with OpenAI format, simply change the model name to switch to other large models:Quick Start
Get API Key
- Visit LaoZhang API Console
- Log in to your account
- Click “Add” on the token management page to create an API Key
- Copy the generated API Key for interface calls
View Request Examples
On the token management page, you can quickly get code examples in various programming languages: Steps:- Go to Token Management Page
- Find the row with the API Key you want to use
- Click the 🔧wrench icon (tool icon) in the “Actions” column
- Select “Request Example” from the pop-up menu
- View complete code examples in the following languages:

- cURL - Command-line testing
- Python (SDK) - Using official OpenAI library
- Python (requests) - Using requests library
- Node.js - JavaScript/TypeScript
- Java - Java application development
- C# - .NET application development
- Go - Go language development
- PHP - Web development
- Ruby - Ruby application development
- And more languages…
- ✅ Complete and runnable: Copy and paste to use
- ✅ Parameter descriptions: Detailed parameter configuration
- ✅ Error handling: Includes exception handling logic
- ✅ Best practices: Follows development standards for each language
Developers are encouraged to check the backend request examples first. These examples are updated in real-time based on the latest API versions, ensuring code accuracy and usability.
Basic Information
API Endpoints
- Primary endpoint:
https://api2.laozhang.ai/v1(Recommended, globally accelerated) - Backup endpoint:
https://api-vip.laozhang.ai/v1(Direct access for overseas servers)
api2.laozhang.ai is configured with globally accelerated bandwidth nodes, recommended for primary use. api-vip.laozhang.ai is a backup domain suitable for direct connection from overseas servers. Switch back to the primary domain if you experience instability.Authentication Method
All API requests need to include authentication information in the Header:Request Format
- Content-Type:
application/json - Encoding: UTF-8
- Request Method: POST (for most interfaces)
Core Interfaces
1. Chat Completions
Create a chat completion request, supports multi-turn conversations. Request Endpoint
Message Format
- cURL
- Python (SDK)
- Python (requests)
- Node.js
- Java
- C#
- Go
- PHP
- Ruby
2. Text Completions
Kept for compatibility with legacy interfaces, Chat Completions is recommended. Request Endpoint3. Embeddings
Convert text to vector representation. Request Endpoint
Complete Code Examples
- cURL
- Python (SDK)
- Python (requests)
- Node.js
4. Images
Generate, edit, or transform images. Generate ImagesRecommended to use
gpt-image-2 model for image generation. For more image generation features and parameter descriptions, please see GPT Image Generation detailed documentation.- cURL
- Python (SDK)
- Node.js
5. Audio
Speech recognition and transcription. Transcribe Audio6. Model List
Get list of available models. Request EndpointStreaming Responses
Enable Streaming Output
Setstream: true in the request:
Streaming Response Format
Response will be returned in Server-Sent Events (SSE) format:Handling Streaming Responses
- Python
- JavaScript
Error Handling
Error Response Format
Common Error Codes
Error Handling Example
Best Practices
1. Request Optimization
- Set max_tokens reasonably: Avoid unnecessarily long outputs
- Use temperature: Control output randomness
- Batch processing: Combine multiple requests to reduce call count
2. Error Retry
Implement exponential backoff retry mechanism:3. Security Recommendations
- Protect API keys: Store in environment variables
- Limit permissions: Create different keys for different applications
- Monitor usage: Regularly check API usage logs
4. Performance Optimization
- Use streaming output: Improve user experience
- Cache responses: Cache results for identical requests
- Concurrency control: Reasonably control concurrent request count
Rate Limits
RPM, TPM, and concurrency limits vary by model, token group, route, and account configuration; there is no single fixed limit for every request. Confirm the current limit in the console and increase production traffic gradually. Requests above the active limit usually return 429. Read the error details, use bounded exponential backoff, and do not retry indefinitely before confirming model access and account credit.Need Help?
- Visit LaoZhang API Official Site
- Check Supported Models
- Contact technical support: hi@laozhang.ai
This manual is continuously updated. Please follow the latest version for new features and improvements.