{"record":{"id":"6267c23c75d36e0a","repo":"continuedev/continue","slug":"ai-sdk-provider-requires-a-model-in-the-format-p","errorCode":null,"errorMessage":"AI SDK provider requires a model in the format '<provider>/<model>' (e.g., 'openai/gpt-4o')","messagePattern":"AI SDK provider requires a model in the format '<provider>/<model>' \\(e\\.g\\., 'openai/gpt-4o'\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/AiSdk.ts","lineNumber":60,"sourceCode":"      baseURL: options.baseURL ?? \"https://openrouter.ai/api/v1/\",\n    }),\n  clawrouter: (options) =>\n    createOpenAI({\n      ...options,\n      baseURL: options.baseURL ?? \"http://localhost:1337/v1/\",\n    }),\n};\n\nexport class AiSdkApi implements BaseLlmApi {\n  private provider?: (modelId: string) => any;\n  private config: AiSdkConfig;\n  private providerId: string;\n  private modelId: string;\n\n  constructor(config: AiSdkConfig) {\n    this.config = config;\n    if (!config.model) {\n      throw new Error(\n        \"AI SDK provider requires a model in the format '<provider>/<model>' (e.g., 'openai/gpt-4o')\",\n      );\n    }\n    const [providerId, ...modelParts] = config.model.split(\"/\");\n    this.providerId = providerId;\n    this.modelId = modelParts.join(\"/\");\n  }\n\n  private initializeProvider() {\n    if (this.provider) {\n      return;\n    }\n\n    const createFn = PROVIDER_MAP[this.providerId];\n    if (!createFn) {\n      const supportedProviders = Object.keys(PROVIDER_MAP).join(\", \");\n      throw new Error(\n        `Unknown AI SDK provider: \"${this.providerId}\". ` +","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/AiSdk.ts#L42-L78","documentation":"The AiSdk provider adapter (OpenAI-compatible) derives its provider and model by splitting config.model on '/'; a missing/empty model string makes construction impossible, so the constructor throws immediately.","triggerScenarios":"new AiSdk({ model: '' }) or omitting model in the config passed to the adapter (e.g. via a model config without a 'model' field).","commonSituations":"YAML/JSON model configs where the model name field is missing or blank, or programmatic config built with a typo'd key.","solutions":["Set model to '<provider>/<model>' e.g. 'openai/gpt-4o' in the adapter config","Check the config source (YAML/config file) for a missing or empty model field","Add a startup validation of model strings before constructing providers"],"exampleFix":"// before\nnew AiSdk({ model: '' });\n\n// after\nnew AiSdk({ model: 'openai/gpt-4o' });","handlingStrategy":"validation","validationCode":"if (!cfg?.model || !/^[^/]+\\/.+/.test(cfg.model)) throw new Error('model must be provider/model');","typeGuard":"function isProviderModelString(s: unknown): s is `${string}/${string}` { return typeof s === 'string' && /^[^/\\s]+\\/[^/\\s]+$/.test(s); }","tryCatchPattern":"try { new AiSdk(config); } catch (e) { if (/requires a model/.test(e.message)) config.model = 'openai/gpt-4o'; else throw e; }","preventionTips":["Always configure model as '<provider>/<model>'","Validate config at startup","Fail fast on empty model fields in config loaders"],"tags":["ai-sdk","provider","config","models"],"backgroundTag":"missing-model-config","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}