Guide to configuring FastGPT for optimal performance and use cases.
| Platform |
Location |
| Docker |
docker-compose.yml environment section |
| Environment File |
.env or .env.local |
| Runtime Config |
Database (MongoDB/PostgreSQL) |
| Data Type |
Location |
| MongoDB |
./mongodb-data/ |
| PostgreSQL |
./postgresql-data/ |
| Config Files |
./fastgpt-config/ |
| Variable |
Description |
Example |
DB_URL |
MongoDB connection string |
mongodb://mongodb:27017/fastgpt |
PG_URL |
PostgreSQL connection string |
postgresql://postgres:postgres@postgresql:5432/fastgpt |
ROOT_KEY |
Root authentication key |
your-secure-random-string |
TOKEN_KEY |
Token signing key |
your-secure-random-string |
| Variable |
Description |
Required For |
OPENAI_API_KEY |
OpenAI API key |
GPT-4, GPT-3.5 |
ANTHROPIC_API_KEY |
Anthropic API key |
Claude models |
AZURE_OPENAI_API_KEY |
Azure OpenAI key |
Azure OpenAI |
HUGGINGFACE_API_KEY |
HuggingFace API key |
HF models |
| Variable |
Description |
Default |
LLM_REQUEST_TRACKING_RETENTION_HOURS |
LLM request log retention |
6 |
HTTPS_PROXY |
HTTP proxy for outbound |
- |
LOG_LEVEL |
Logging verbosity |
info |
MAX_TOKENS |
Default max tokens |
4096 |
Settings → Model Providers:
-
Add OpenAI:
- Name: OpenAI
- API Key: sk-…
- Base URL: https://api.openai.com/v1
- Models: gpt-4, gpt-3.5-turbo
-
Add Anthropic:
- Name: Anthropic
- API Key: sk-ant-…
- Models: claude-3-5-sonnet, claude-3-opus
-
Add Local (Ollama):
- Name: Ollama
- Base URL: http://host.docker.internal:11434/v1
- Models: llama3.2, qwen2.5
| Parameter |
Description |
Typical Value |
| Temperature |
Response randomness |
0.7 |
| Max Tokens |
Maximum response length |
2048 |
| Top P |
Nucleus sampling |
0.9 |
| Frequency Penalty |
Repetition penalty |
0.0 |
| Presence Penalty |
Topic diversity |
0.0 |
- Go to Knowledge Base tab
- Click “Create Knowledge Base”
- Configure:
- Name and description
- Permission settings
- Indexing settings
| Setting |
Options |
Recommended |
| Chunk Size |
100-2000 tokens |
512 |
| Overlap |
0-500 tokens |
50 |
| Index Type |
Vector, Full-text, Hybrid |
Hybrid |
| Rerank Model |
BGE-Reranker, Cohere |
BGE-Reranker |
| Format |
Extensions |
Notes |
| Text |
.txt, .md |
Direct import |
| Documents |
.pdf, .docx |
OCR for PDFs |
| Presentations |
.pptx |
Slide-by-slide |
| Spreadsheets |
.csv, .xlsx |
Row-based parsing |
| Web |
URLs |
Auto-crawl |
Settings → Workflow:
| Setting |
Description |
Default |
| Debug Mode |
Enable workflow debugging |
Off |
| Auto-Save |
Auto-save workflow changes |
On |
| Version Control |
Keep workflow versions |
On |
LLM Node:
- Select model
- Set system prompt
- Configure parameters
- Set max tokens
Knowledge Base Node:
- Select knowledge bases
- Set search limit
- Configure reranking
- Set similarity threshold
HTTP Request Node:
- Set method (GET/POST)
- Configure headers
- Set request body
- Handle response
Settings → API:
| Setting |
Description |
| API Keys |
Generate/manage API keys |
| Rate Limits |
Configure rate limiting |
| CORS |
Configure cross-origin access |
| Webhooks |
Configure webhook endpoints |
POST /api/v1/completions
Headers:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Body:
{
"app_id": "your-app-id",
"messages": [
{"role": "user", "content": "Hello!"}
],
"stream": false
}
Settings → Security:
| Setting |
Description |
| Root Password |
Change default password |
| API Keys |
Manage API access |
| User Permissions |
Role-based access |
| Session Timeout |
Auto-logout timeout |
| Setting |
Recommendation |
| HTTPS |
Use reverse proxy with TLS |
| Firewall |
Restrict port 3000 access |
| CORS |
Configure allowed origins |
| Rate Limiting |
Enable API rate limits |
Settings → Operations:
| Setting |
Description |
Default |
| Conversation Retention |
How long to keep chats |
30 days |
| Data Annotation |
Enable annotation |
On |
| Export Format |
Default export format |
JSON |
| Setting |
Description |
Default |
| Log Level |
Logging verbosity |
info |
| Log Retention |
How long to keep logs |
7 days |
| Audit Logs |
Enable audit logging |
On |
Docker Compose:
services:
fastgpt:
deploy:
resources:
limits:
cpus: '4'
memory: 4G
reservations:
cpus: '2'
memory: 2G
| Setting |
Description |
Recommended |
| Query Cache |
Cache frequent queries |
Enable |
| Model Cache |
Cache model responses |
Enable |
| Cache TTL |
Cache time-to-live |
1 hour |
Cron Job Example:
# Daily backup at 2 AM
0 2 * * * cd /opt/fastgpt && tar -czf /backup/fastgpt-$(date +\%Y\%m\%d).tar.gz mongodb-data/ postgresql-data/
| Data |
Priority |
| MongoDB data |
Critical |
| PostgreSQL data |
Critical |
| Configuration files |
High |
| Uploaded files |
Medium |
| Issue |
Solution |
| Cannot connect to database |
Check DB_URL and PG_URL |
| Model not responding |
Verify API key |
| High memory usage |
Reduce context length |
| Slow responses |
Enable caching |
# View logs
docker compose logs -f fastgpt
# Search for errors
docker compose logs fastgpt | grep ERROR
# Check startup issues
docker compose logs fastgpt | grep -E "error|failed"
Any questions?
Feel free to contact us. Find all contact information on our contact page.