Langou API Overview
The Langou API enables developers to integrate Langou's AI reply generation, Chinese input processing, and prompt optimization into their own applications. The API follows RESTful conventions, uses JSON for request/response formats, and authenticates via API keys. All endpoints are available at https://api.langou-ime.com/v1.
Authentication
All API requests require an API key passed via the Authorization header:
Authorization: Bearer YOUR_API_KEY
API keys are available through the Developer Dashboard at https://langou-ime.com/developer. Each key is scoped to specific permissions (read, write, admin) and can be rotated or revoked independently.
Rate limits: 100 requests/minute for API keys. Contact us for higher limits.
AI Reply Generation Endpoint
POST /v1/replies/generate
Generate AI-powered chat replies based on conversation context and desired style.
Request body:
{
"context": [
{"sender": "user", "text": "Did you finish the report?"},
{"sender": "me", "text": "Almost done, just need the final numbers"},
{"sender": "user", "text": "Can you send it by 3 PM?"}
],
"style": "professional",
"count": 3,
"language": "en"
}
Response:
{
"suggestions": [
"Absolutely. I'll have the final report with all numbers ready for you by 3 PM.",
"Yes, I'll make sure you have it before 3 PM. Just compiling the final data now.",
"3 PM works perfectly. I'll send it over with the completed numbers."
],
"style": "professional",
"model": "mimo-v2.5-pro",
"generation_time_ms": 842
}
Style Customization API
POST /v1/styles/custom
Create custom reply styles with fine-grained personality parameters.
Request body:
{
"name": "Coach",
"base_style": "warm",
"parameters": {
"formality": 0.3,
"enthusiasm": 0.8,
"empathy": 0.9,
"directness": 0.6,
"humor": 0.2,
"emotional_expression": 0.7
},
"description": "Encouraging, supportive tone for mentoring"
}
Prompt Optimization Endpoint
POST /v1/prompts/optimize
Optimize prompts for use with ChatGPT, DeepSeek, Claude, or other AI models.
Request body:
{
"original_text": "Write an email about the project delay",
"target_model": "chatgpt",
"detail_level": "detailed"
}
Response:
{
"optimized": "Write a professional project delay notification email addressed to stakeholders. Include: (1) acknowledgment of the delay, (2) the reason for the delay, (3) revised timeline, (4) mitigation steps being taken. Use a transparent but constructive tone.",
"concise": "Draft a stakeholder email about a project delay: transparent tone, include reason, new timeline, and next steps.",
"improvements": ["Added stakeholder context", "Specified email structure", "Clarified tone guidance"]
}
Dictionary Management API
POST /v1/dictionary/entries — Add entries to user dictionary
GET /v1/dictionary/entries — List dictionary entries
DELETE /v1/dictionary/entries — Remove dictionary entries
Manage custom dictionary entries programmatically — useful for enterprise deployments that need to seed industry-specific terminology.
Webhook Integration
Langou supports outgoing webhooks to notify your application when certain events occur:
- reply.sent: Fired when a user sends an AI-generated reply
- style.changed: Fired when the user switches reply styles
- feedback.received: Fired when a user rates an AI suggestion
- error.occurred: Fired when an AI generation fails
Webhooks are configured via the Developer Dashboard with optional retry logic, HMAC signature verification, and custom payload filtering.
SDKs & Libraries
Official client libraries are available for:
- Python:
pip install langou-api - JavaScript/TypeScript:
npm install langou-api - Java/Kotlin: Available via Maven Central
- Swift: Available via Swift Package Manager
Community-maintained libraries are listed in our resources. See the full API reference at docs.langou-ime.com.
Getting Started
- Get your API key — Visit the Developer Dashboard
- Read the docs — Full API reference with examples at docs.langou-ime.com
- Join the developer community — Our Discord has dedicated API channels
For integration help, visit our or check the Comparison to see how Langou's API differs from other platforms.