Supported Models
Note:
OpenAIChatModelis compatible with OpenAI API specification, works with vLLM, DeepSeek, etc.GeminiChatModelsupports both Gemini API and Vertex AI
Getting API Keys
ModelRegistry
ModelRegistry (io.agentscope.core.model.ModelRegistry) resolves a Model from a string id, so you do not have to call each vendor’s *ChatModel.builder() for simple setups. With Harness, use HarnessAgent.builder().model(String); anywhere else that needs a Model, call ModelRegistry.resolve(...) and pass the result into ReActAgent or other builders.
API summary
ModelFactory is a functional interface: Model create(String modelId) with the full id string.
Built-in id formats and environment variables
With the right environment variables set, you can use these id forms (withresolve or HarnessAgent.Builder.model(String), for example):
Within one process, repeated
resolve of the same factory-based id returns a cached Model instance. Named registrations are not cached that way.
Example: named registration (reuse a tuned model)
Build once with full control, then register under a name:Example: built-in prefix (default connection settings)
Example: custom factory
DashScope
Alibaba Cloud LLM platform, providing Qwen series models.Configuration
Endpoint Type (endpointType)
DashScope models support both text and multimodal API endpoints. By default, the framework automatically detects the appropriate endpoint type based on the model name (e.g.,qwen-vl-* and qwen3.5 series automatically use the multimodal endpoint).
When auto-detection is inaccurate (e.g., using custom model names or compatible APIs), you can manually specify the endpoint type:
Thinking Mode
OpenAI
OpenAI models and compatible APIs.Compatible APIs
For DeepSeek, vLLM, and other compatible providers. Note that you need to configure the appropriate Formatter and structured output capabilities:Configuration
Anthropic
Anthropic’s Claude series models.Configuration
Gemini
Google’s Gemini series models, supporting both Gemini API and Vertex AI.Gemini API
Vertex AI
Configuration
For endpoint override, use
baseUrl(...). For more advanced transport or proxy setup, continue to use httpOptions(...) or clientOptions(...).
Ollama
Self-hosted open-source LLM platform supporting various models.Configuration
Advanced Configuration
For advanced model loading and generation parameters:GenerateOptions Support
Ollama also supportsGenerateOptions for standard configuration:
Available Parameters
Ollama supports over 40 parameters for fine-tuning:Model Loading Parameters
numCtx: Context window size (default: 2048)numBatch: Batch size for prompt processing (default: 512)numGPU: Number of layers to offload to GPU (-1 for all)lowVRAM: Enable low VRAM mode for limited GPU memoryuseMMap: Use memory mapping for model loadinguseMLock: Lock model in memory to prevent swapping
Generation Parameters
temperature: Generation randomness (0.0-2.0)topK: Top-K sampling (standard: 40)topP: Nucleus sampling (standard: 0.9)minP: Minimum probability threshold (default: 0.0)numPredict: Max tokens to generate (-1 for infinite)repeatPenalty: Penalty for repetitions (default: 1.1)presencePenalty: Penalty based on token presencefrequencyPenalty: Penalty based on token frequencyseed: Random seed for reproducible resultsstop: Strings that stop generation immediately
Sampling Strategies
mirostat: Mirostat sampling (0=disabled, 1=Mirostat v1, 2=Mirostat v2)mirostatTau: Target entropy for Mirostat (default: 5.0)mirostatEta: Learning rate for Mirostat (default: 0.1)tfsZ: Tail-free sampling (default: 1.0 disables)typicalP: Typical probability sampling (default: 1.0)
Generation Options
Configure generation parameters withGenerateOptions:
Parameters
Tool Choice Strategy
Additional Parameters
Support for provider-specific parameters:Timeout and Retry
Formatter
Formatter converts AgentScope’s unified message format to each LLM provider’s API format. Each provider has two types of Formatter:Default Behavior
When no Formatter is specified, the model uses the correspondingChatFormatter, suitable for single-agent scenarios.
Multi-Agent Scenarios
In multi-agent collaboration (such as Pipeline, MsgHub), useMultiAgentFormatter. It will:
- Merge messages from multiple agents into conversation history
- Use
<history></history>tags to structure historical messages - Distinguish between current agent and other agents’ messages