Examples
May 30, 2026 · View on GitHub
This directory contains various examples demonstrating different capabilities of the deepseek-go library.
| # | Example Name | Description |
|---|---|---|
| 0 | Using External Providers | Supports external providers through baseURL extension. Missing model constants can be reported via issues or pull requests. |
| 1 | Basic Chat Example | Demonstrates basic chat functionality. |
| 2 | Chat with Streaming | Implements streaming chat responses, including ReasoningContent with V4 models. |
| 3 | Fill-in-Middle (FIM) | Example of fill-in-middle completion with streaming support. |
| 4 | JSON Mode | Demonstrates JSON mode for structured responses. This is a client-specific feature. |
| 5 | Multi-Chat | Example of handling multiple concurrent chat sessions. |
| 6 | Bad Multi-Chat | Demonstrates incorrect handling of multiple chats (for educational purposes). |
| 7 | Balance Example | Shows balance-related functionality. |
| 8 | Client with Options | Demonstrates creating a client with custom options. |
| 9 | Prefix Completion | Example of prefix-based completion. |
| 10 | Token Usage Estimation | Demonstrates how to estimate and track token usage for requests (based on Deepseek’s documentation). |
| 11 | List Supported Models | Shows how to list all supported models through the Deepseek API. |
| 12 | Function Calling | Demonstrates function calling capabilities. |
| 13 | OpenRouter Images | Example usage with OpenRouter images. |
| 14 | Reasoning Effort | Demonstrates reasoning_effort parameter ("high" vs "max") for V4 thinking mode. |
| 15 | User ID Isolation | Multi-tenant isolation using the user_id parameter. |
| 16 | Strict Tool Calling | Strict function calling (beta) with automatic /beta routing. |
| 17 | Anthropic API | Anthropic-compatible endpoint with Claude model mapping, thinking, tool use, and streaming. |
Ollama
Ollama docs are located here.