11import {
2- AUTOCOMPLETE_PROVIDER_MODELS ,
32 AutocompleteProviderKey ,
43 defaultProviderUsabilityChecker ,
54 getKiloBaseUriFromToken ,
@@ -14,7 +13,15 @@ import { ApiStreamChunk } from "../../api/transform/stream"
1413import { ILLM , LLMOptions } from "../continuedev/core/index.js"
1514import { DEFAULT_AUTOCOMPLETE_OPTS } from "../continuedev/core/util/parameters.js"
1615import Mistral from "../continuedev/core/llm/llms/Mistral"
17- import { OpenAI } from "../continuedev/core/llm/llms/OpenAI"
16+ import OpenRouter from "../continuedev/core/llm/llms/OpenRouter"
17+ import KiloCode from "../continuedev/core/llm/llms/KiloCode"
18+
19+ export const AUTOCOMPLETE_PROVIDER_MODELS = {
20+ mistral : "codestral-2501" ,
21+ kilocode : "codestral-2501" ,
22+ openrouter : "mistralai/codestral-2501" ,
23+ bedrock : "mistral.codestral-2501-v1:0" ,
24+ } as const
1825
1926export class AutocompleteModel {
2027 private apiHandler : ApiHandler | null = null
@@ -118,6 +125,16 @@ export class AutocompleteModel {
118125 useCache : false , // Disable caching for autocomplete
119126 } ,
120127 uniqueId : `autocomplete-${ provider } -${ Date . now ( ) } ` ,
128+ // Add env for KiloCode metadata (organizationId and tester suppression)
129+ env : config . organizationId
130+ ? {
131+ kilocodeOrganizationId : config . organizationId ,
132+ // Add tester suppression if configured
133+ ...( this . profile ?. kilocodeTesterWarningsDisabledUntil && {
134+ kilocodeTesterWarningsDisabledUntil : this . profile . kilocodeTesterWarningsDisabledUntil ,
135+ } ) ,
136+ }
137+ : undefined ,
121138 }
122139
123140 // Create appropriate LLM instance based on provider
@@ -131,7 +148,12 @@ export class AutocompleteModel {
131148 /**
132149 * Extracts provider-specific configuration (API key, base URL, model) from this.profile
133150 */
134- private extractProviderConfig ( ) : { apiKey : string ; apiBase : string ; model : string } | null {
151+ private extractProviderConfig ( ) : {
152+ apiKey : string
153+ apiBase : string
154+ model : string
155+ organizationId ?: string
156+ } | null {
135157 if ( ! this . profile ?. apiProvider ) {
136158 return null
137159 }
@@ -158,8 +180,9 @@ export class AutocompleteModel {
158180 }
159181 return {
160182 apiKey : this . profile . kilocodeToken ,
161- apiBase : `${ getKiloBaseUriFromToken ( this . profile . kilocodeToken ) } /openrouter/ api/v1` ,
183+ apiBase : `${ getKiloBaseUriFromToken ( this . profile . kilocodeToken ) } /api/openrouter /v1` ,
162184 model,
185+ organizationId : this . profile . kilocodeOrganizationId ,
163186 }
164187
165188 case "openrouter" :
@@ -194,9 +217,12 @@ export class AutocompleteModel {
194217 return new Mistral ( options )
195218
196219 case "kilocode" :
220+ // Use dedicated KiloCode class with custom headers and routing
221+ return new KiloCode ( options )
222+
197223 case "openrouter" :
198- // Both use OpenAI-compatible API
199- return new OpenAI ( options )
224+ // Use standard OpenRouter
225+ return new OpenRouter ( options )
200226
201227 case "bedrock" :
202228 // Bedrock would need a custom implementation
0 commit comments