Skip to content

Commit a26fbd1

Browse files
feat(providers): add deepseek responses adapter (#285)
* feat(providers): add deepseek responses adapter * docs(deepseek): add provider guide with reasoning effort mapping Document DeepSeek V4's two-level reasoning_effort surface and the low/medium -> high remap so users aren't surprised by the upgrade. Cross-link from the Codex guide and add a comment on normalizeReasoningEffort pointing to the user-facing table. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 1bc20ab commit a26fbd1

18 files changed

Lines changed: 584 additions & 21 deletions

File tree

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</p>
2424

2525
<p align="center">
26-
A fast and lightweight AI gateway written in Go, providing a unified OpenAI-compatible API for OpenAI, Anthropic, Gemini, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama, and more.
26+
A fast and lightweight AI gateway written in Go, providing a unified OpenAI-compatible API for OpenAI, Anthropic, Gemini, DeepSeek, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama, and more.
2727
</p>
2828

2929
<a href="docs/dashboard.gif">
@@ -51,6 +51,7 @@ docker run --rm -p 8080:8080 \
5151
-e OPENAI_API_KEY="your-openai-key" \
5252
-e ANTHROPIC_API_KEY="your-anthropic-key" \
5353
-e GEMINI_API_KEY="your-gemini-key" \
54+
-e DEEPSEEK_API_KEY="your-deepseek-key" \
5455
-e GROQ_API_KEY="your-groq-key" \
5556
-e OPENROUTER_API_KEY="your-openrouter-key" \
5657
-e ZAI_API_KEY="your-zai-key" \
@@ -90,6 +91,7 @@ Example model identifiers are illustrative and subject to change; consult provid
9091
| OpenAI | `OPENAI_API_KEY` | `gpt-5.5` |||||||
9192
| Anthropic | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514` |||||||
9293
| Google Gemini | `GEMINI_API_KEY` | `gemini-2.5-flash` |||||||
94+
| DeepSeek | `DEEPSEEK_API_KEY` | `deepseek-v4-pro` |||||||
9395
| Groq | `GROQ_API_KEY` | `llama-3.3-70b-versatile` |||||||
9496
| OpenRouter | `OPENROUTER_API_KEY` | `google/gemini-2.5-flash` |||||||
9597
| Z.ai | `ZAI_API_KEY` (`ZAI_BASE_URL` optional) | `glm-5.1` |||||||
@@ -105,7 +107,9 @@ For Z.ai's GLM Coding Plan, set `ZAI_BASE_URL=https://api.z.ai/api/coding/paas/v
105107
Configured model lists are available for every provider with
106108
`<PROVIDER>_MODELS`, for example
107109
`OPENROUTER_MODELS=openai/gpt-oss-120b,anthropic/claude-sonnet-4` or
108-
`ORACLE_MODELS=openai.gpt-oss-120b,xai.grok-3`. By default,
110+
`ORACLE_MODELS=openai.gpt-oss-120b,xai.grok-3`. DeepSeek defaults to
111+
`https://api.deepseek.com`; set `DEEPSEEK_BASE_URL` only when using a compatible
112+
proxy or alternate DeepSeek endpoint. By default,
109113
`CONFIGURED_PROVIDER_MODELS_MODE=fallback` uses those lists only when upstream
110114
`/models` is unavailable or empty. Set `CONFIGURED_PROVIDER_MODELS_MODE=allowlist`
111115
to expose only configured models for providers that define a list, skipping
@@ -288,7 +292,7 @@ See [DEVELOPMENT.md](docs/DEVELOPMENT.md) for testing, linting, and pre-commit s
288292
### Must Have
289293

290294
- [ ] Intelligent routing
291-
- [ ] Broader provider support: Oracle model configuration via environment variables, plus Cohere, Command A, Operational, and DeepSeek V3
295+
- [ ] Broader provider support: Cohere, Command A, and Operational
292296
- [ ] Budget management with limits per `user_path` and/or API key
293297
- [ ] Editable model pricing for accurate cost tracking and budgeting
294298
- [ ] Full support for the OpenAI `/responses` and `/conversations` lifecycle

cmd/gomodel/docs/docs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4355,7 +4355,7 @@ var SwaggerInfo = &swag.Spec{
43554355
BasePath: "/",
43564356
Schemes: []string{"http"},
43574357
Title: "GoModel API",
4358-
Description: "High-performance AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic, Gemini, Groq, OpenRouter, Z.ai, xAI, Oracle, Ollama). Drop-in OpenAI-compatible API.",
4358+
Description: "High-performance AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic, Gemini, Groq, OpenRouter, DeepSeek, Z.ai, xAI, MiniMax, Oracle, Ollama). Drop-in OpenAI-compatible API.",
43594359
InfoInstanceName: "swagger",
43604360
SwaggerTemplate: docTemplate,
43614361
LeftDelim: "{{",

cmd/gomodel/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"gomodel/internal/providers"
1919
"gomodel/internal/providers/anthropic"
2020
"gomodel/internal/providers/azure"
21+
"gomodel/internal/providers/deepseek"
2122
"gomodel/internal/providers/gemini"
2223
"gomodel/internal/providers/groq"
2324
"gomodel/internal/providers/minimax"
@@ -73,7 +74,7 @@ func startApplication(application lifecycleApp, addr string) error {
7374

7475
// @title GoModel API
7576
// @version 1.0
76-
// @description High-performance AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic, Gemini, Groq, OpenRouter, Z.ai, xAI, MiniMax, Oracle, Ollama). Drop-in OpenAI-compatible API.
77+
// @description High-performance AI gateway routing requests to multiple LLM providers (OpenAI, Anthropic, Gemini, Groq, OpenRouter, DeepSeek, Z.ai, xAI, MiniMax, Oracle, Ollama). Drop-in OpenAI-compatible API.
7778
// @BasePath /
7879
// @schemes http
7980
// @securityDefinitions.apikey BearerAuth
@@ -119,6 +120,7 @@ func main() {
119120
factory.Add(azure.Registration)
120121
factory.Add(oracle.Registration)
121122
factory.Add(anthropic.Registration)
123+
factory.Add(deepseek.Registration)
122124
factory.Add(gemini.Registration)
123125
factory.Add(groq.Registration)
124126
factory.Add(minimax.Registration)

config/config.example.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,11 @@ providers:
264264
# - openai.gpt-oss-120b
265265
# - xai.grok-3
266266

267-
# Example: DeepSeek (OpenAI-compatible)
267+
# Example: DeepSeek. GoModel translates /v1/responses requests to DeepSeek
268+
# chat completions because DeepSeek does not expose a native Responses API.
268269
# deepseek:
269-
# type: "openai"
270-
# base_url: "https://api.deepseek.com/v1"
270+
# type: "deepseek"
271+
# base_url: "https://api.deepseek.com"
271272
# api_key: "${DEEPSEEK_API_KEY}"
272273

273274
# Example: local Ollama server with explicit per-model metadata.

config/config_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func clearProviderEnvVars(t *testing.T) {
1818
"OPENAI_API_KEY", "OPENAI_BASE_URL", "OPENAI_MODELS",
1919
"ANTHROPIC_API_KEY", "ANTHROPIC_BASE_URL", "ANTHROPIC_MODELS",
2020
"GEMINI_API_KEY", "GEMINI_BASE_URL", "GEMINI_MODELS",
21+
"DEEPSEEK_API_KEY", "DEEPSEEK_BASE_URL", "DEEPSEEK_MODELS",
2122
"XAI_API_KEY", "XAI_BASE_URL", "XAI_MODELS",
2223
"GROQ_API_KEY", "GROQ_BASE_URL", "GROQ_MODELS",
2324
"OPENROUTER_API_KEY", "OPENROUTER_BASE_URL", "OPENROUTER_MODELS", "OPENROUTER_SITE_URL", "OPENROUTER_APP_NAME",

docs/about/roadmap.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ icon: "list-todo"
77
### Must Have
88

99
- [ ] Intelligent routing
10-
- [ ] Broader provider support: Oracle model configuration via environment variables, plus Cohere, Command A, Operational, and DeepSeek V3
10+
- [ ] Broader provider support: Cohere, Command A, and Operational
1111
- [ ] Budget management with limits per `user_path` and/or API key
1212
- [ ] Editable model pricing for accurate cost tracking and budgeting
1313
- [ ] Full support for the OpenAI `/responses` and `/conversations` lifecycle

docs/adr/0001-explicit-provider-registration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Context
44

5-
GoModel supports multiple LLM providers, including OpenAI, Anthropic, Gemini, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama, and custom OpenAI-compatible endpoints. Each provider must be registered with the factory before use.
5+
GoModel supports multiple LLM providers, including OpenAI, Anthropic, Gemini, DeepSeek, xAI, Groq, OpenRouter, Z.ai, Azure OpenAI, Oracle, Ollama, and custom OpenAI-compatible endpoints. Each provider must be registered with the factory before use.
66

77
## Decision
88

docs/advanced/configuration.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ Set these to automatically register providers. No YAML configuration required.
181181
| `OPENAI_API_KEY` | OpenAI |
182182
| `ANTHROPIC_API_KEY` | Anthropic |
183183
| `GEMINI_API_KEY` | Google Gemini |
184+
| `DEEPSEEK_API_KEY` | DeepSeek |
184185
| `OPENROUTER_API_KEY` | OpenRouter |
185186
| `ZAI_API_KEY` | Z.ai |
186187
| `XAI_API_KEY` | xAI (Grok) |
@@ -190,7 +191,7 @@ Set these to automatically register providers. No YAML configuration required.
190191
| `OLLAMA_BASE_URL` | Ollama (no API key needed) |
191192
| `VLLM_BASE_URL` | vLLM (no API key needed unless upstream requires) |
192193

193-
Most providers can use a custom base URL via `<PROVIDER>_BASE_URL` (for example `OPENAI_BASE_URL`). OpenRouter defaults to `https://openrouter.ai/api/v1` and can be overridden with `OPENROUTER_BASE_URL`. Z.ai defaults to `https://api.z.ai/api/paas/v4`; set `ZAI_BASE_URL=https://api.z.ai/api/coding/paas/v4` for the GLM Coding Plan endpoint. vLLM defaults to `http://localhost:8000/v1` when `VLLM_API_KEY` is set, but keyless deployments should set `VLLM_BASE_URL` explicitly to register the provider. Azure uses `AZURE_BASE_URL` for its deployment base URL and accepts an optional `AZURE_API_VERSION` override; otherwise it defaults to `2024-10-21`. Oracle requires `ORACLE_BASE_URL` because its OpenAI-compatible endpoint is region-specific.
194+
Most providers can use a custom base URL via `<PROVIDER>_BASE_URL` (for example `OPENAI_BASE_URL`). DeepSeek defaults to `https://api.deepseek.com`; set `DEEPSEEK_BASE_URL` only for a compatible proxy or alternate DeepSeek endpoint. OpenRouter defaults to `https://openrouter.ai/api/v1` and can be overridden with `OPENROUTER_BASE_URL`. Z.ai defaults to `https://api.z.ai/api/paas/v4`; set `ZAI_BASE_URL=https://api.z.ai/api/coding/paas/v4` for the GLM Coding Plan endpoint. vLLM defaults to `http://localhost:8000/v1` when `VLLM_API_KEY` is set, but keyless deployments should set `VLLM_BASE_URL` explicitly to register the provider. Azure uses `AZURE_BASE_URL` for its deployment base URL and accepts an optional `AZURE_API_VERSION` override; otherwise it defaults to `2024-10-21`. Oracle requires `ORACLE_BASE_URL` because its OpenAI-compatible endpoint is region-specific.
194195

195196
Every provider type also accepts a comma-separated configured model list via
196197
`<PROVIDER>_MODELS`, for example `OPENROUTER_MODELS`, `ORACLE_MODELS`,
@@ -311,6 +312,7 @@ The simplest way to add providers. GoModel checks for well-known API key environ
311312
export OPENAI_API_KEY="sk-..." # Registers "openai" provider
312313
export ANTHROPIC_API_KEY="sk-ant-..." # Registers "anthropic" provider
313314
export GEMINI_API_KEY="..." # Registers "gemini" provider
315+
export DEEPSEEK_API_KEY="..." # Registers "deepseek" provider
314316
export XAI_API_KEY="..." # Registers "xai" provider
315317
export GROQ_API_KEY="gsk_..." # Registers "groq" provider
316318
export OPENROUTER_API_KEY="sk-or-..." # Registers "openrouter" provider
@@ -381,6 +383,12 @@ providers:
381383
- openai.gpt-oss-120b
382384
- xai.grok-3
383385
386+
# Add DeepSeek. GoModel translates /v1/responses to DeepSeek chat completions.
387+
deepseek:
388+
type: deepseek
389+
base_url: "https://api.deepseek.com"
390+
api_key: "..."
391+
384392
# Add a vLLM OpenAI-compatible server
385393
vllm:
386394
type: vllm

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"pages": [
8787
"guides/openclaw",
8888
"guides/oracle",
89+
"guides/deepseek",
8990
"guides/vllm",
9091
"guides/multiple-ollama",
9192
"guides/claude-code",

docs/getting-started/quickstart.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ icon: "rocket"
77
## Run GoModel in 30 Seconds
88

99
GoModel is an OpenAI-compatible AI gateway. You can connect one endpoint and
10-
route traffic across OpenAI, Anthropic, Gemini, xAI, Groq, OpenRouter, Z.ai,
11-
Azure OpenAI, Oracle, Ollama, and more while keeping auth, audit logs, and admin
12-
visibility in one place.
10+
route traffic across OpenAI, Anthropic, Gemini, DeepSeek, xAI, Groq, OpenRouter,
11+
Z.ai, Azure OpenAI, Oracle, Ollama, and more while keeping auth, audit logs, and
12+
admin visibility in one place.
1313

1414
### 1. Start GoModel
1515

@@ -26,9 +26,10 @@ docker run --rm -p 8080:8080 \
2626

2727
<Note>
2828
Set at least one provider credential or base URL
29-
(`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `XAI_API_KEY`,
30-
`GROQ_API_KEY`, `OPENROUTER_API_KEY`, `ZAI_API_KEY`, `AZURE_API_KEY` +
31-
`AZURE_BASE_URL`, `ORACLE_API_KEY` + `ORACLE_BASE_URL`,
29+
(`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`,
30+
`DEEPSEEK_API_KEY`, `XAI_API_KEY`, `GROQ_API_KEY`, `OPENROUTER_API_KEY`,
31+
`ZAI_API_KEY`, `AZURE_API_KEY` + `AZURE_BASE_URL`,
32+
`ORACLE_API_KEY` + `ORACLE_BASE_URL`,
3233
`OLLAMA_BASE_URL`) or GoModel will have no models to route. GoModel also
3334
works well with additional OpenAI-compatible providers out of the box.
3435
</Note>

0 commit comments

Comments
 (0)