deepseek

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package deepseek implements the Adapter against DeepSeek's OpenAI-compatible chat-completions API. DeepSeek hugs the OpenAI contract tightly, so NormalizeResponse is a pass-through.

Usage: import this package from cmd/shim/main.go and call

a, err := deepseek.New(opts)
adapter.Register(a)

before constructing the server. Each call to New returns a fresh instance, so tests can build isolated adapters without touching package state.

Index

Constants

View Source
const (
	// Name is the registry key for this adapter.
	Name = "deepseek"
	// DefaultBaseURL is used when config leaves UpstreamBaseURL empty.
	DefaultBaseURL = "https://api.deepseek.com/v1"
	// DefaultModel is the legacy fallback used when the caller sends an
	// empty model name and no UPSTREAM_MODEL is configured.
	DefaultModel = "deepseek-chat"
	// DefaultOpusModel maps claude-opus* requests to deepseek-v4-pro per
	// DeepSeek's create-chat-completion API reference, which documents the
	// OpenAI-format endpoint's allowed values as exactly
	// [deepseek-v4-flash, deepseek-v4-pro]. The "[1m]" 1M-context variant
	// only works on DeepSeek's native Anthropic endpoint (/anthropic), not
	// the OpenAI-format one shim uses.
	DefaultOpusModel = "deepseek-v4-pro"
	// DefaultSonnetModel maps claude-sonnet* requests per the same guide.
	DefaultSonnetModel = "deepseek-v4-flash"
	// DefaultHaikuModel maps claude-haiku* requests per the same guide.
	DefaultHaikuModel = "deepseek-v4-flash"
)

Variables

This section is empty.

Functions

func New

func New(opts ConfigureOpts) (adapter.Adapter, error)

New constructs a configured DeepSeek adapter. Caller must register the returned adapter via adapter.Register before the server reads it. The error return is reserved for future construction-time validation; today it is always nil and the actual config gate is Adapter.Validate at server startup.

Types

type ConfigureOpts

type ConfigureOpts struct {
	BaseURL       string
	APIKey        string
	ModelOverride string
	OpusModel     string
	SonnetModel   string
	HaikuModel    string
}

ConfigureOpts holds New parameters as a struct so signature changes don't ripple to every call site.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL