Models
Large language models are the most powerful AI tools available today — they serve as the engine that powers agent execution.
Models are the reasoning engine of agents. They drive the agent's decision-making process, determining which tools to call, how to interpret results, and when to provide the final answer. DeepSeek, with its openness, innovation, and excellent cost-efficiency, has become one of the preferred LLMs for agent development.
Creating a Model
Everything starts with createModel(). You only need to specify the model name to create a model instance — the API key is automatically read from the DEEPSEEK_API_KEY environment variable:
If you need to explicitly pass an API key or use a custom endpoint, you can configure apiKey and baseURL:
Sending Requests
Once you've created a model, you can use invoke() to send a complete chat completion request and get the model's full response:
If you want to receive the model's output in real time, you can use invokeStream() for streaming requests:
Enabling Thinking Mode
DeepSeek models have thinking mode enabled by default. The model performs deep reasoning before answering, which is ideal for handling complex problems. The default reasoning effort is 'high'. You can disable thinking mode or adjust the reasoning effort as needed:
Cloning Model Configuration
When you need to create instances with different configurations based on the same model, you can use withConfig() to avoid repeated initialization:
withConfig() merges the new configuration into the current instance and returns a new model instance — the original instance is not affected.
API Reference
Parameters
deepseek-v4-flash, deepseek-v4-pro, or a custom string. DEEPSEEK_API_KEY env variablehttps://api.deepseek.com600003
