Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ __pycache__/
*$py.class

# Virtual environments
.env/
.venv/
venv/

# Env files
.env*
!.env.example

# Packaging artifacts
build/
dist/
Expand Down
8 changes: 5 additions & 3 deletions DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
3) Start the server:
docker compose up -d chatmock

- Compose publishes the same host port as `PORT` from `.env`, so changing `PORT` changes the URL you should use.

4) Free to use it in whichever chat app you like!

## Configuration
Set options in `.env` or pass environment variables:
- `PORT`: Container listening port (default 8000)
- `PORT`: Container listening port and published host port for the `chatmock` service (default 8000)
- `CHATMOCK_IMAGE`: image tag to run (default `storagetime/chatmock:latest`)
- `VERBOSE`: `true|false` to enable request/stream logs
- `CHATGPT_LOCAL_REASONING_EFFORT`: minimal|low|medium|high|xhigh
Expand All @@ -34,8 +36,8 @@ Set `VERBOSE=true` to include extra logging for debugging issues in upstream or

## Test

```
curl -s http://localhost:8000/v1/chat/completions \
```bash
curl -s "http://localhost:${PORT:-8000}/v1/chat/completions" \
-H 'Content-Type: application/json' \
-d '{"model":"gpt-5-codex","messages":[{"role":"user","content":"Hello world!"}]}' | jq .
```
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ services:
env_file: .env
environment:
- CHATGPT_LOCAL_HOME=/data
- PORT=${PORT:-8000}
ports:
- "8000:8000"
- "127.0.0.1:${PORT:-8000}:${PORT:-8000}"
volumes:
- chatmock_data:/data
- ./prompt.md:/app/prompt.md:ro
healthcheck:
test: ["CMD-SHELL", "python -c \"import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health').status==200 else 1)\" "]
test: ["CMD-SHELL", "python -c \"import os,urllib.request,sys; port=os.getenv('PORT', '8000'); sys.exit(0 if urllib.request.urlopen(f'http://127.0.0.1:{port}/health').status==200 else 1)\" "]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -24,11 +25,11 @@ services:
command: ["login"]
environment:
- CHATGPT_LOCAL_HOME=/data
- CHATGPT_LOCAL_LOGIN_BIND=0.0.0.0
- CHATGPT_LOCAL_LOGIN_BIND=127.0.0.1
volumes:
- chatmock_data:/data
ports:
- "1455:1455"
- "127.0.0.1:1455:1455"

volumes:
chatmock_data: