セルフホスティング
Schiftエージェントは、任意のOpenAI互換LLMエンドポイントに接続できます。これにより、開発用にローカルモデルを使用したり、プロダクションでセルフホストされたモデルを使用したりできます。
Ollama
Section titled “Ollama”# Install Ollamacurl -fsSL https://ollama.ai/install.sh | sh
# Pull a modelollama pull llama3const agent = new Agent({ name: "Local Agent", instructions: "You are a helpful assistant.", model: "llama3", baseUrl: "http://localhost:11434/v1",});
const result = await agent.run("Hello!");APIキーは不要です。Ollamaはあなたのマシン上でローカルに実行されます。
# Start vLLM serverpython -m vllm.entrypoints.openai.api_server \ --model mistralai/Mistral-7B-Instruct-v0.3 \ --port 8000const agent = new Agent({ name: "vLLM Agent", instructions: "You are a helpful assistant.", model: "mistralai/Mistral-7B-Instruct-v0.3", baseUrl: "http://127.0.0.1:8002/v1",});LiteLLM
Section titled “LiteLLM”LiteLLMは、100以上のLLMプロバイダー向けのOpenAI互換プロキシを提供します。
litellm --model ollama/llama3 --port 4000const agent = new Agent({ name: "LiteLLM Agent", instructions: "You are a helpful assistant.", model: "ollama/llama3", baseUrl: "http://localhost:4000/v1",});直接プロバイダーエンドポイント
Section titled “直接プロバイダーエンドポイント”Schift Cloudのルーティングなしでクラウドプロバイダーに直接接続します:
OpenAI
Section titled “OpenAI”const agent = new Agent({ name: "OpenAI Direct", instructions: "...", model: "gpt-4o-mini", baseUrl: "https://api.openai.com/v1", apiKey: process.env.OPENAI_API_KEY,});Anthropic(プロキシ経由)
Section titled “Anthropic(プロキシ経由)”AnthropicのAPIはOpenAI互換ではありません。LiteLLMをプロキシとして使用します:
litellm --model anthropic/claude-sonnet-4-6 --port 4000const agent = new Agent({ model: "anthropic/claude-sonnet-4-6", baseUrl: "http://localhost:4000/v1",});モードの混合
Section titled “モードの混合”エージェントにセルフホストされたLLMを使用しながら、Schift CloudをRAGに使用することができます:
const schift = new Schift({ apiKey: "sch_..." });const rag = new RAG({ bucket: "docs" }, schift.transport);
const agent = new Agent({ name: "Hybrid Agent", instructions: "...", rag, // RAG via Schift Cloud model: "llama3", // LLM via Ollama baseUrl: "http://localhost:11434/v1",});