{"record":{"id":"8da2c6f80b735e8d","repo":"continuedev/continue","slug":"model-modelname-not-found-in-assistant-configur-8da2c6","errorCode":null,"errorMessage":"Model ${modelName} not found in assistant configuration","messagePattern":"Model (.+?) not found in assistant configuration","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/continue-sdk/typescript/src/createOpenAIClient.ts","lineNumber":69,"sourceCode":"    apiKey,\n    baseURL: new URL(\"model-proxy/v1/\", baseURL).toString(),\n    fetch: async (url, init) => {\n      // Clone the init object to avoid modifying the original\n      const modifiedInit = init ? { ...init } : {};\n\n      if (init?.method === \"POST\" && init?.body) {\n        try {\n          const body = JSON.parse(init.body as string);\n\n          const modelName = body.model;\n\n          // Look up the model in the assistant's models\n          const modelConfig = assistantModels?.find(\n            (m) => m?.model === modelName || m?.model.endsWith(modelName),\n          );\n\n          if (!modelConfig) {\n            throw new Error(\n              `Model ${modelName} not found in assistant configuration`,\n            );\n          }\n\n          if (\n            !(\"apiKeyLocation\" in modelConfig) &&\n            !(\"envSecretLocations\" in modelConfig)\n          ) {\n            throw new Error(\n              `Model ${modelName} does not have an apiKeyLocation or envSecretLocations defined`,\n            );\n          }\n\n          const continueProperties: ContinueProperties = {\n            apiKeyLocation: modelConfig.apiKeyLocation,\n            envSecretLocations: modelConfig.envSecretLocations,\n            orgScopeId: organizationId ?? null,\n          };","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/continue-sdk/typescript/src/createOpenAIClient.ts#L51-L87","documentation":"Inside createOpenAIClient's fetch override, when a request specifies a model that does not match any model in the assistant's models list (exact match or endsWith), this error is thrown before the request is proxied to Continue.","triggerScenarios":"Chat completion via the OpenAI-compatible client with body.model set to a name not present in the assistant config's models (e.g. 'gpt-4-turbo' when only 'gpt-4o' is configured).","commonSituations":"Hardcoded model names in existing OpenAI SDK code, model renamed/removed in the assistant config, or passing a fully-qualified name when config uses a short one (or vice versa).","solutions":["Set the OpenAI client's model to one listed in assistant config models (or the first model's name)","Update the assistant config to include the model you're requesting","Use exact model strings; matching is exact or suffix-based","Construct the client with a full models list including the one you'll request"],"exampleFix":"// before\nconst completion = await client.chat.completions.create({ model: 'gpt-4-turbo', messages });\n\n// after\nconst completion = await client.chat.completions.create({ model: 'gpt-4o', messages });","handlingStrategy":"validation","validationCode":"const ok = assistantModels?.some(m => m.model === requested || m.model.endsWith(requested));","typeGuard":"function modelAvailable(models: { model: string }[] | undefined, name: string): boolean { return !!models?.some(m => m.model === name || m.model.endsWith(name)); }","tryCatchPattern":"try { await client.chat.completions.create({ model, messages }); } catch (e) { if (/not found in assistant configuration/.test(e.message)) model = firstModel; /* retry */ else throw e; }","preventionTips":["Pin client model to assistant config's first model or an exact listed name","Keep model strings in sync with the assistant config","Fall back to the default model on lookup failure"],"tags":["continue-sdk","openai-compat","models","lookup"],"backgroundTag":"model-not-found","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}