Language Models
Pick, inspect, and configure language models for your agents. Use this guide when you are selecting models, balancing cost versus latency, or migrating from provider-specific IDs to managed catalog entries.
Model coverage per interface lives in the AIP capability matrix. Highlights: selecting by language_model_id and applying runtime overrides are fully supported via the SDK. CLI flags for some workflows may lag; use export/import or SDK helpers for those flows.
Discover Models
When to use: Inventory available providers or confirm new deployments before routing traffic.
from glaip_sdk import Client
client = Client()
for model in client.list_language_models():
print(model["id"], model["name"], model.get("provider"))CLI equivalent:
aip models listThe response includes provider, model name, optional base URL, and any capability flags (context length, streaming support, etc.).
Assign Models to Agents
When to use: Update default models or move from legacy provider/model pairs to catalog-managed IDs.
The SDK supports three ways to specify models, from simplest to most flexible:
1. Model Constants (Recommended)
Use typed constants for IDE autocomplete, validation, and to avoid typos. These resolve to the standardized provider/model format.
Available constants:
OpenAI
from glaip_sdk.models import OpenAI
GPT_5_NANO, GPT_5_MINI, GPT_5, GPT_4O
Anthropic
from glaip_sdk.models import Anthropic
CLAUDE_SONNET_4_0, CLAUDE_OPUS_4_0
from glaip_sdk.models import Google
GEMINI_2_5_FLASH, GEMINI_2_5_PRO
Azure OpenAI
from glaip_sdk.models import AzureOpenAI
GPT_4O, GPT_4O_MINI
DeepInfra
from glaip_sdk.models import DeepInfra
QWEN3_30B_A3B, KIMI_K2_INSTRUCT
DeepSeek
from glaip_sdk.models import DeepSeek
DEEPSEEK_CHAT
AWS Bedrock
from glaip_sdk.models import Bedrock
CLAUDE_SONNET_4_20250514_V1_0
The default model is OpenAI.GPT_5_NANO.
2. String Format (Direct)
Use the standardized provider/model format directly as a string. Use this when you need a model not in the constants, or when working in environments without IDE support.
Format patterns:
OpenAI:
openai/<model>→openai/gpt-5,openai/gpt-4oDeepInfra:
deepinfra/<org>/<model>→deepinfra/Qwen/Qwen3-30B-A3BDeepSeek:
deepseek/<org>/<model>→deepseek/deepseek-ai/DeepSeek-V3.1Anthropic:
anthropic/<model>→anthropic/claude-sonnet-4-0Google:
google/<model>→google/gemini-2.5-flashAzure OpenAI:
azure-openai/<model>→azure-openai/gpt-4o
Invalid formats (missing /) raise a ValueError with suggestions to use model constants.
Common routing issues
Agent still uses the old model
Cached agent config or CLI not updated.
Re-run aip agents update and confirm the agent payload includes the new language_model_id.
400 Unknown model errors
Model ID not available in the target environment.
List models in that environment or request the provider be deployed there.
High latency after switching models
New model has different performance profile.
Adjust timeout_seconds in agent_config for latency-sensitive runs.
Streaming stops mid-response
Model lacks streaming support.
Disable streaming for that agent or choose a streaming-capable model.
Advanced: Custom Model Configuration
For custom endpoints, credentials, and hyperparameters not covered by the standard format, use the Model class:
Model Configuration Breakdown:
id: Model identifier inprovider/modelformat. Use"custom/<name>"for custom providers not in built-in constants.base_url: The API endpoint URL for the model provider (e.g.,"https://api.moonshot.ai/v1").credentials: API key as a string, or a dict with additional credential fields.hyperparameters: Model-specific parameters liketemperature,max_tokens,top_p, etc.
Custom DeepInfra Model with Credentials
Credential Precedence: When using Model with credentials, the SDK uses this priority order:
Explicit credentials in
Model.credentials(highest priority)Environment variables (e.g.,
DEEPINFRA_API_KEY,OPENAI_API_KEY)Credential files or default locations
For providers like DeepInfra and DeepSeek, the SDK automatically resolves the base_url from built-in configurations, so you don't need to specify it unless using a custom endpoint.
Local vs Remote Execution
When to use: Understand how model configuration behaves when switching between local execution (via agent.run()) and remote execution (via agent.deploy() and server-side runs).
How Model Configuration Works
Local (agent.run())
Model object with base_url, credentials, hyperparameters
Full configuration is used directly by aip_agents
Local
String like "deepinfra/Qwen/Qwen3-30B-A3B"
SDK resolves base_url from built-in provider mappings; credentials from env vars
Remote (agent.deploy())
Model object or string
Agent is deployed to AIP server; server uses its configured language_model_id mappings
Remote
language_model_id="uuid"
Server looks up model in its catalog; ignores local config
Example: Local Execution with AIP Server Models
When a model exists on the AIP server (has a language_model_id), you can still use it locally:
Built-in Provider Configurations: The SDK includes default base_url mappings for:
deepinfra→https://api.deepinfra.com/v1/openaideepseek→https://api.deepseek.com
For these providers, you only need to set the corresponding environment variable (DEEPINFRA_API_KEY, DEEPSEEK_API_KEY) or pass credentials explicitly.
Example: Custom Model Not in AIP Server
For models not configured on the AIP server, use the Model class with full configuration:
Switching Between Local and Remote
When you call agent.deploy(), the agent is synchronized with the AIP server. The server manages its own model catalog via language_model_id mappings:
Configuration Isolation:
Local execution uses your local environment:
base_url, credentials fromModelor env varsRemote execution uses AIP server's configuration:
language_model_idmappings, server-side credentialsChanges to local model config don't affect deployed agents until you call
agent.deploy()again
Using Custom Models with AIP Server
When to use: You want to use a custom model in remote execution (via agent.deploy()) that's not in the AIP server's catalog.
Option 1: Local Execution (Recommended for Custom Models)
For models not in the AIP server catalog, the simplest approach is to use local execution with the Model class:
This works immediately without any server-side configuration. The SDK passes your credentials and configuration directly to the local runner.
Option 2: Register Model on AIP Server
To use a custom model in remote execution (via agent.deploy()), the model must be registered on the AIP server first.
Check available models:
Register a new model:
The CLI does not currently support creating language models directly. You have two options:
Option A: Use the REST API (requires admin/master API key)
Required fields:
provider: Provider identifier (e.g.,"custom","openai-compatible")name: Model name identifier
Optional fields:
base_url: API endpoint URL for the providercredentials: API key or authentication tokenhyperparameters: Default hyperparameters liketemperature,max_tokens, etc.capabilities: Feature flags (streaming, function calling, etc.) - configured server-sidecontext_length: Maximum context window size - configured server-side
Option B: Ask your admin to register the model with details like:
provider: Provider identifier (e.g.,"custom","openai-compatible")name: Model name (e.g.,"kimi-k2.5")base_url: API endpoint URL (e.g.,"https://api.moonshot.ai/v1")credentials: API key for authenticationhyperparameters: Default model settings (optional)
Once registered, you can use the model by name in remote execution:
When to register on server:
You need remote execution (running agents on AIP server infrastructure)
You want to share the model across your team without sharing API keys
You want centralized credential management (API keys stored on server, not locally)
When to use local execution:
Quick prototyping and testing
Models with local-only access or custom endpoints
When you don't have admin access to register models
Related Documentation
Agents — apply models during creation and updates, plus runtime overrides.
Automation & scripting — script model discovery and promotion across environments.
CLI commands reference — view available models with
aip models list.
Last updated
Was this helpful?