A VSCode extension that provides an OpenAI-compatible API server interface directly within VSCode.
- Implements OpenAI-compatible REST API endpoints
- Automatically starts when VSCode launches
- Provides status command to check server status
- Compatible with OpenAI API clients
The server runs on http://localhost:3000 and provides the following endpoints:
Lists available models (currently returns mock data for gpt-3.5-turbo and gpt-4)
Example:
curl http://localhost:3000/v1/modelsChat completion endpoint compatible with OpenAI's API format
Example:
curl -X POST http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"stream": true
}'- Install the extension in VSCode
- The server automatically starts when VSCode launches
- Use the "Show OpenAI Server Status" command to check the server status
- The server will be available at
http://localhost:3000
To build the extension:
- Clone the repository
- Run
npm install - Run
npm run compile - Press F5 to launch a new VSCode window with the extension
- Visual Studio Code 1.96.0 or higher
This extension contributes the following settings:
openaiCompatibleServer.port: Port number for the OpenAI compatible server (default: 3000)openaiCompatibleServer.defaultModel: Default model to use when none is specified in the request. One of:claude-3.5-sonnetgpt-4ogpt-4o-minio3-minio1(default:gpt-4o)
To modify these settings:
- Open VSCode Settings (File > Preferences > Settings)
- Search for "OpenAI Compatible Server"
- Adjust the settings as needed
- The server currently returns mock responses
Initial release:
- Basic OpenAI-compatible API server
- Models and chat completions endpoints
- Server status command