コンテンツにスキップ

セルフホスティング

Schiftエージェントは、任意のOpenAI互換LLMエンドポイントに接続できます。これにより、開発用にローカルモデルを使用したり、プロダクションでセルフホストされたモデルを使用したりできます。

Terminal window
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model
ollama pull llama3
const 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はあなたのマシン上でローカルに実行されます。

Terminal window
# Start vLLM server
python -m vllm.entrypoints.openai.api_server \
--model mistralai/Mistral-7B-Instruct-v0.3 \
--port 8000
const 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は、100以上のLLMプロバイダー向けのOpenAI互換プロキシを提供します。

Terminal window
litellm --model ollama/llama3 --port 4000
const agent = new Agent({
name: "LiteLLM Agent",
instructions: "You are a helpful assistant.",
model: "ollama/llama3",
baseUrl: "http://localhost:4000/v1",
});

直接プロバイダーエンドポイント

Section titled “直接プロバイダーエンドポイント”

Schift Cloudのルーティングなしでクラウドプロバイダーに直接接続します:

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のAPIはOpenAI互換ではありません。LiteLLMをプロキシとして使用します:

Terminal window
litellm --model anthropic/claude-sonnet-4-6 --port 4000
const agent = new Agent({
model: "anthropic/claude-sonnet-4-6",
baseUrl: "http://localhost:4000/v1",
});

エージェントにセルフホストされた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",
});