Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions kiloclaw/controller/src/config-writer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ describe('generateBaseConfig', () => {
expect(config.models.providers.kilocode.headers['X-KiloCode-OrganizationId']).toBe(
'org_abc123'
);
// baseUrl must be a string (OpenClaw schema requires it); fall back to
// the production URL when no KILOCODE_API_BASE_URL override is active.
expect(config.models.providers.kilocode.baseUrl).toBe('https://api.kilo.ai/api/gateway/');
expect(config.models.providers.kilocode.models).toEqual([]);
});

Expand Down
4 changes: 4 additions & 0 deletions kiloclaw/controller/src/config-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export function generateBaseConfig(
config.models = config.models ?? {};
config.models.providers = config.models.providers ?? {};
config.models.providers.kilocode = config.models.providers.kilocode ?? {};
// OpenClaw's provider schema requires baseUrl to be a string. Preserve an
// existing dev override (KILOCODE_API_BASE_URL), otherwise use the production URL.
config.models.providers.kilocode.baseUrl =
config.models.providers.kilocode.baseUrl ?? 'https://api.kilo.ai/api/gateway/';
config.models.providers.kilocode.headers = config.models.providers.kilocode.headers ?? {};
config.models.providers.kilocode.headers['X-KiloCode-OrganizationId'] =
env.KILOCODE_ORGANIZATION_ID;
Expand Down