Skip to main content
The model layer connects AgentScope to LLM providers through a two-tier hierarchy. A Credential sits at the top, with the model families the provider exposes beneath it: LLM (Chat Model), TTS, Embedding, and Realtime Model. A Credential carries the API authentication fields a provider requires (api_key, base_url, …). From a single credential, you can discover every model the provider offers in each family it supports. The table below shows each built-in credential and the model classes under it: This layering mirrors the natural frontend flow (register a credential first, then pick a model from under it), letting the UI authenticate once and surface every model family the provider supports. All model families share the same construction pattern: a model takes a credential, a model name, and an optional provider-specific Parameters object. Each family page covers its own creation and invocation details:
  • LLM: drives an agent’s conversation and tool calls
  • TTS: converts text into synthesized speech audio
  • Embedding: converts text and media into dense vectors
Realtime Model is coming soon: we are migrating Realtime Model support from v1.0 to v2.0.

Integrate with Frontend

What is ModelCard

A model card is a declarative description of a model’s capabilities and constraints, designed to drive the frontend: model selectors, parameter forms, and feature toggles can be rendered dynamically without hardcoding any provider-specific knowledge. Each model family has its own card class: All three card classes share a common core of fields: On top of the common core, each card type adds family-specific fields: input_types and output_types use MIME types to describe modality. Common values: Each card is defined by a YAML file that ships alongside the model implementation. The tabs below show a real card from each family:

Parameter Schema and Overrides

The parameter_schema exposed to the frontend is built in two layers:
  1. Base schema: auto-derived from the model’s Parameters class via model_json_schema(). This lists every adjustable parameter (temperature, max_tokens, thinking_enable, …) along with its type and the API-wide range.
  2. Per-model overrides: the YAML’s parameter_overrides block is merged on top, field by field.
Overrides matter because adjustable ranges are not uniform across an API: every Qwen model accepts max_tokens, but each one has a different ceiling. Overrides let a card tighten a range, pin a default, or hide a parameter that doesn’t apply.
Some adjustments are applied automatically, without an explicit override: chat cards drop thinking_enable / thinking_budget when application/x-thinking is absent from output_types and cap max_tokens at output_size; TTS cards turn the voices list into an enum on the voice field.

Retrieve ModelCards

Model card discovery follows the hierarchy: credential class ⇒ model class ⇒ model cards. Each credential knows its linked model class for every family (get_chat_model_class(), get_tts_model_classes(), get_embedding_model_class()), and each model class loads the YAML card definitions from the _models/ directory next to its implementation:
In practice, call list_models() on either end of the chain. The tabs below show the retrieval for each family:
This design allows the frontend to discover available models, their capabilities, and valid parameter ranges, all from a single credential, without any hardcoded provider logic.

Next Steps

LLM

Create and call chat models, generate structured output, and add custom providers.

TTS

Synthesize speech in standard and realtime modes, and integrate TTS with agents.

Embedding

Embed text and multimodal content, with built-in batching, retry, and caching.