Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
AIMock is a service built on Node.js and Express.js designed to emulate the behavior of OpenAI's APIs. It can receive API requests and return mock responses for chat completions, text generation, and image generation. This service is perfect for development and testing when actual AI-generated results are not required.
Run with npx:
npx aimock
Install in your project:
npm install aimock
# or
yarn add aimock
Install globally:
npm install -g aimock
You can set environment variables in a .env
file to specify configurations for the service. The following environment
variables are available:
MOCK_PORT
: The port for the service, default is 5001MOCK_TYPE
: The type of mock responses, options are "random"
, "echo"
, or "fixed"
, default is "random"
MOCK_FILE
: The path to a text file for randomly generating response content, default is "data/contents.txt"
MOCK_FILE_SEPARATOR
: The separator for different response contents in the text file, default is the newline
character ("\n"
)After the service is started, you will see the following output on the console:
Server is running at http://localhost:5001
You can visit http://localhost:5001
to verify that the service is running. If the service is working correctly, you
will see the greeting message: "Hello World! This is OpenAI Mock Server."
AIMock Server provides the following main routes:
/v1/chat/completions
- Mocks the chat model completions of OpenAI. Supports both stream and non-stream mode.
Accepts POST requests.
/v1/completions
- Mocks the text model completions of OpenAI. Supports both stream and non-stream mode. Accepts
POST requests.
/v1/images/generations
- Mocks the image generation of OpenAI. Accepts POST requests.
You can provide a mockType
parameter in the request body to specify the type of mock response. Acceptable mockType
values are "random"
, "echo"
, or "fixed"
. The default is "random"
.
For more detailed API documentation and examples, please refer to the /docs
directory in the project.
If you find any issues or have any suggestions, feel free to open an issue or submit a pull request.
This project is inspired by MockAI
This project is licensed under the MIT license. For more details, please refer to the LICENSE
file.
FAQs
An OpenAI api simulator for developing and testing
We found that aimock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.