diff --git a/README.md b/README.md index e5aa076fd..6b4be430e 100644 --- a/README.md +++ b/README.md @@ -160,7 +160,6 @@ Copilot is a Sim-managed service. To use Copilot on a self-hosted instance: - Go to https://sim.ai → Settings → Copilot and generate a Copilot API key - Set `COPILOT_API_KEY` in your self-hosted environment to that value -- Host Sim on a publicly available DNS and set NEXT_PUBLIC_APP_URL and BETTER_AUTH_URL to that value ([ngrok](https://ngrok.com/)) ## Tech Stack diff --git a/apps/sim/app/api/copilot/api-keys/route.ts b/apps/sim/app/api/copilot/api-keys/route.ts index f0122f60b..45d4eb08e 100644 --- a/apps/sim/app/api/copilot/api-keys/route.ts +++ b/apps/sim/app/api/copilot/api-keys/route.ts @@ -19,7 +19,10 @@ export async function GET(request: NextRequest) { const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/get-api-keys`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { + 'Content-Type': 'application/json', + ...(env.COPILOT_API_KEY ? { 'x-api-key': env.COPILOT_API_KEY } : {}), + }, body: JSON.stringify({ userId }), }) @@ -61,7 +64,10 @@ export async function DELETE(request: NextRequest) { const res = await fetch(`${SIM_AGENT_API_URL}/api/validate-key/delete`, { method: 'POST', - headers: { 'Content-Type': 'application/json' }, + headers: { + 'Content-Type': 'application/json', + ...(env.COPILOT_API_KEY ? { 'x-api-key': env.COPILOT_API_KEY } : {}), + }, body: JSON.stringify({ userId, apiKeyId: id }), })