@@ -16,9 +16,31 @@ A complete OpenAI API compatible mock server that returns predefined test data w
16
16
17
17
## 🚀 Quick Start
18
18
19
- ### Method 1: Docker (Recommended )
19
+ ### Method 1: Public Service (No Setup Required )
20
20
21
- The easiest way to run Mock OpenAI API is using Docker from [ Docker Hub] ( https://hub.docker.com/r/zerob13/mock-openai-api ) :
21
+ The quickest way to get started is using our public deployment service:
22
+
23
+ ** Base URL** : ` https://mockllm.anya2a.com/v1 `
24
+ ** API Key** : ` DeepChat `
25
+
26
+ ``` bash
27
+ # Test the public service
28
+ curl https://mockllm.anya2a.com/v1/models \
29
+ -H " Authorization: Bearer DeepChat"
30
+
31
+ # Chat completion example
32
+ curl -X POST https://mockllm.anya2a.com/v1/chat/completions \
33
+ -H " Content-Type: application/json" \
34
+ -H " Authorization: Bearer DeepChat" \
35
+ -d ' {
36
+ "model": "mock-gpt-thinking",
37
+ "messages": [{"role": "user", "content": "Hello"}]
38
+ }'
39
+ ```
40
+
41
+ ### Method 2: Docker (Recommended for Local Development)
42
+
43
+ The easiest way to run Mock OpenAI API locally is using Docker from [ Docker Hub] ( https://hub.docker.com/r/zerob13/mock-openai-api ) :
22
44
23
45
``` bash
24
46
# Pull and run the latest image
@@ -44,7 +66,7 @@ Available environment variables:
44
66
- ` TZ ` : Timezone setting (default: UTC)
45
67
- ` NODE_ENV ` : Node.js environment (default: production)
46
68
47
- ### Method 2 : Docker Compose
69
+ ### Method 3 : Docker Compose
48
70
49
71
Create a ` docker-compose.yml ` file:
50
72
@@ -68,7 +90,7 @@ Then run:
68
90
docker-compose up -d
69
91
```
70
92
71
- ### Method 3 : NPM Installation
93
+ ### Method 4 : NPM Installation
72
94
73
95
``` bash
74
96
npm install -g mock-openai-api
@@ -420,10 +442,13 @@ docker run -p 3000:3000 my-mock-openai-api
420
442
### Testing with curl
421
443
422
444
``` bash
423
- # Test health check
424
- curl http://localhost:3000/health
445
+ # Test public service
446
+ curl https://mockllm.anya2a.com/health
447
+ curl https://mockllm.anya2a.com/v1/models \
448
+ -H " Authorization: Bearer DeepChat"
425
449
426
- # Test model list
450
+ # Test local service
451
+ curl http://localhost:3000/health
427
452
curl http://localhost:3000/v1/models
428
453
429
454
# Test thinking model
@@ -475,7 +500,14 @@ curl -X POST http://localhost:3000/v1/images/generations \
475
500
``` javascript
476
501
import OpenAI from ' openai' ;
477
502
503
+ // Using the public service
478
504
const client = new OpenAI ({
505
+ baseURL: ' https://mockllm.anya2a.com/v1' ,
506
+ apiKey: ' DeepChat'
507
+ });
508
+
509
+ // Or using local deployment
510
+ const localClient = new OpenAI ({
479
511
baseURL: ' http://localhost:3000/v1' ,
480
512
apiKey: ' mock-key' // can be any value
481
513
});
0 commit comments