This page describes how to run OpenChat Playground (OCP) with OpenAI models integration.
-
Get the repository root.
# bash/zsh REPOSITORY_ROOT=$(git rev-parse --show-toplevel)
# PowerShell $REPOSITORY_ROOT = git rev-parse --show-toplevel
-
Make sure you are at the repository root.
cd $REPOSITORY_ROOT
-
Add OpenAI API Key for OpenAI GPT connection. Make sure you should replace
{{OPENAI_API_KEY}}with your OpenAI API key.# bash/zsh dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp \ set OpenAI:ApiKey "{{OPENAI_API_KEY}}"
# PowerShell dotnet user-secrets --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp ` set OpenAI:ApiKey "{{OPENAI_API_KEY}}"
For more details about OpenAI API Keys, refer to the doc, API Keys.
-
Run the app. The default model OCP uses is GPT-4.1-mini.
# bash/zsh dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ --connector-type OpenAI
# PowerShell dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` --connector-type OpenAI
Alternatively, if you want to run with a different model, say GPT-4o, other than the default one, you can specify it as an argument:
# bash/zsh dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- \ --connector-type OpenAI \ --model gpt-4o
# PowerShell dotnet run --project $REPOSITORY_ROOT/src/OpenChat.PlaygroundApp -- ` --connector-type OpenAI ` --model gpt-4o
-
Open your web browser, navigate to
http://localhost:5280, and enter prompts.
-
Make sure you are at the repository root.
cd $REPOSITORY_ROOT
-
Build a container.
docker build -f Dockerfile -t openchat-playground:latest . -
Get OpenAI API Key.
# bash/zsh API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ sed -n '/^\/\//d; p' | jq -r '."OpenAI:ApiKey"')
# PowerShell $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'OpenAI:ApiKey'
-
Run the app. The default model OCP uses is GPT-4.1-mini.
# bash/zsh - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest \ --connector-type OpenAI \ --api-key $API_KEY
# PowerShell - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest ` --connector-type OpenAI ` --api-key $API_KEY
# bash/zsh - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ --connector-type OpenAI \ --api-key $API_KEY
# PowerShell - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` --connector-type OpenAI ` --api-key $API_KEY
Alternatively, if you want to run with a different model, say GPT-4o, other than the default one, you can specify it as an argument:
# bash/zsh - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest \ --connector-type OpenAI \ --api-key $API_KEY \ --model gpt-4o
# PowerShell - from locally built container docker run -i --rm -p 8080:8080 openchat-playground:latest ` --connector-type OpenAI ` --api-key $API_KEY ` --model gpt-4o
# bash/zsh - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest \ --connector-type OpenAI \ --api-key $API_KEY \ --model gpt-4o
# PowerShell - from GitHub Container Registry docker run -i --rm -p 8080:8080 ghcr.io/aliencube/open-chat-playground/openchat-playground:latest ` --connector-type OpenAI ` --api-key $API_KEY ` --model gpt-4o
-
Open your web browser, navigate to
http://localhost:8080, and enter prompts.
-
Make sure you are at the repository root.
cd $REPOSITORY_ROOT
-
Login to Azure.
azd auth login
-
Check login status.
azd auth login --check-status
-
Initialize
azdtemplate.azd init
NOTE: You will be asked to provide environment name for provisioning.
-
Get OpenAI API Key.
# bash/zsh API_KEY=$(dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | \ sed -n '/^\/\//d; p' | jq -r '."OpenAI:ApiKey"')
# PowerShell $API_KEY = (dotnet user-secrets --project ./src/OpenChat.PlaygroundApp list --json | ` Select-String -NotMatch '^//(BEGIN|END)' | ConvertFrom-Json).'OpenAI:ApiKey'
-
Set OpenAI API Key to azd environment variables.
azd env set OPENAI_API_KEY $API_KEY
The default model OCP uses is GPT-4.1-mini. If you want to run with a different model, say gpt-4o, other than the default one, add it to azd environment variables.
azd env set OPENAI_MODEL gpt-4o -
Set the connector type to
OpenAI.azd env set CONNECTOR_TYPE OpenAI -
Run the following commands in order to provision and deploy the app.
azd up
NOTE: You will be asked to provide Azure subscription and location for deployment.
Once deployed, you will be able to see the deployed OCP app URL.
-
Open your web browser, navigate to the OCP app URL, and enter prompts.
-
Clean up all the resources.
azd down --force --purge