Chat
AI-powered chat assistance for FiveM and RedM development.
The Chat API provides AI-powered assistance for FiveM and RedM development questions. Powered by advanced language models, it offers contextual help, code examples, and troubleshooting guidance.
Overview
The Chat API is an intelligent assistant specifically trained for CitizenFX development:
- Expert Knowledge - Specialized in FiveM, RedM, and CitizenFX development
- Code Generation - Creates working code examples and snippets
- Troubleshooting - Helps debug issues and find solutions
- Best Practices - Provides guidance on optimal development approaches
- Framework Support - Covers ESX, QBCore, and other popular frameworks
The AI assistant can help with:
- Resource development and structure
- Native function usage and examples
- Database integration and optimization
- Performance optimization techniques
- Security best practices
- Framework-specific implementations
Base URL
Authentication
The Chat API requires proper authentication and respects rate limiting to ensure fair usage.
Endpoints
POST /api/chat
Sends a chat message to the AI assistant and receives a contextual response.
Request Body
Parameters
Parameter | Type | Description | Default |
---|---|---|---|
messages | array | Chat message history | Required |
model | string | AI model to use (gpt-4o-mini , claude-3-sonnet ) | gpt-4o-mini |
temperature | number | Response creativity (0.0-1.0) | 0.7 |
stream | boolean | Enable streaming response | false |
context.framework | string | Target framework (esx , qbcore , standalone ) | null |
context.environment | string | Environment (client , server , shared ) | null |
context.topic | string | Topic area (development , troubleshooting , optimization ) | null |
Response Format
Example Usage
Streaming Responses
For real-time interaction, enable streaming responses:
Use Cases
Development Assistant
Interactive Tutorial System
AI Code Assistant Integration
Model Capabilities
Available Models
Model | Strengths | Use Cases |
---|---|---|
gpt-4o-mini | Fast, cost-effective, good for general questions | Quick help, code completion, basic debugging |
claude-3-sonnet | Advanced reasoning, detailed explanations | Complex problem solving, code review, architecture |
gpt-4-turbo | Balanced performance and capability | Most development tasks, tutorials, optimization |
Specialized Knowledge
The AI assistant has specialized knowledge in:
- FiveM/RedM Development - Resource structure, manifests, natives
- Framework Expertise - ESX, QBCore, vRP, and custom frameworks
- Database Integration - MySQL, oxmysql, async patterns
- Performance Optimization - Profiling, caching, efficient code patterns
- Security Best Practices - Input validation, injection prevention
- UI Development - NUI, HTML/CSS/JS integration
- Networking - Events, callbacks, synchronization
Rate Limiting
- 50 requests per hour for free users
- 200 requests per hour for authenticated users
- Streaming responses count as single requests
- Rate limits reset every hour
Error Handling
Standard HTTP status codes:
200
: Success400
: Bad Request - Invalid message format401
: Unauthorized - Authentication required429
: Too Many Requests - Rate limit exceeded500
: Server Error - AI service error
Example error response:
Best Practices
-
Context Setting
- Provide relevant framework and environment information
- Include error messages and relevant code when debugging
- Be specific about what you're trying to achieve
-
Question Quality
- Ask specific, focused questions
- Include relevant code snippets
- Mention your experience level for appropriate responses
-
Code Integration
- Always test AI-generated code before production use
- Understand the code before implementing it
- Adapt suggestions to your specific use case
-
Performance
- Use streaming for real-time interfaces
- Cache responses for repeated questions
- Implement proper error handling and fallbacks
Support
For questions about the Chat API, please join our Discord. We can help with:
- API integration
- Model selection
- Best practices
- Feature requests
The Chat API is continuously improved with better FiveM/RedM specific knowledge and capabilities.
Always review and test AI-generated code before using it in production environments.