import { describe, expect, it } from 'vitest'; import { modelEndpoint } from '../src/model-endpoint.js'; describe('modelEndpoint', () => { it('sends local models straight to Ollama under their own tag', () => { expect(modelEndpoint('ollama/llama3.1:8b', { env: {} })).toEqual({ url: 'http://127.0.0.1:11434/v1', apiKey: 'ollama', model: 'llama3.1:8b', }); expect(modelEndpoint('ollama/qwen3:8b', { env: { OLLAMA_HOST: '10.0.0.5:11500/' } }).url) .toBe('http://10.0.0.5:11500/v1'); }); it('sends other models through the configured proxy', () => { expect(modelEndpoint('claude-sonnet-4-6', { env: {} })).toEqual({ url: 'http://localhost:4000/v1', apiKey: 'sk-waggle-dev', model: 'claude-sonnet-4-6', }); expect( modelEndpoint('gpt-4o', { litellmUrl: 'http://proxy:9000/v1', env: { LITELLM_MASTER_KEY: 'master' } }), ).toEqual({ url: 'http://proxy:9000/v1', apiKey: 'master', model: 'gpt-4o' }); }); });