Skip to content

Add native DeepSeek provider via the Responses API - #755

Open
zhang0098 wants to merge 2 commits into
vercel-labs:mainfrom
zhang0098:feat/deepseek-provider
Open

Add native DeepSeek provider via the Responses API#755
zhang0098 wants to merge 2 commits into
vercel-labs:mainfrom
zhang0098:feat/deepseek-provider

Conversation

@zhang0098

Copy link
Copy Markdown

Summary

Adds DeepSeek as a native model provider that fx talks to directly. Requests route straight from fx to the DeepSeek API (api.deepseek.com) over the OpenAI Responses protocol with your own key, never through Vercel AI Gateway, OpenAI, or xAI.

Registering DeepSeek with fx login deepseek

DeepSeek is pay-as-you-go and key-based, so there is no OAuth browser sign-in. Configure it from the terminal:

export DEEPSEEK_API_KEY=sk-...   # create a key in the DeepSeek Platform console
fx login deepseek                # validates the key and selects DeepSeek
fx

Notes on how this flow behaves, so the docs and copy stay honest:

  • fx login deepseek checks the DEEPSEEK_API_KEY environment variable, fetches the authenticated DeepSeek model catalog with it, and persists only the provider/model selection (profile settings under ~/.fx).
  • The key itself is read from the environment on every request. fx saves no DeepSeek login session, does not write the key to the macOS Keychain or to any ~/.fx file, and never sends it to Vercel, OpenAI, or xAI.
  • fx logout deepseek prints that nothing is stored.
  • fx login deepseek reports fx needs a DeepSeek API key for this model. Set DEEPSEEK_API_KEY. when the variable is missing or empty, and fx provider deepseek and /provider can select DeepSeek the same way.

What changes

  • New deepseek provider id wired into the CLI, TUI provider menu, model catalog, credential resolution, and permission review.
  • src/gateway/deepseek.zig: DeepSeek transport over the Responses API, including streaming, tool use, and image input; src/gateway/deepseek_models.zig: authenticated model catalog; src/gateway/deepseek_permission_reviewer.zig: permission review for direct DeepSeek traffic.
  • Thinking-mode chain of thought is stored with your sessions so continued tool use can pass it back to the API.
  • README usage docs for the new provider.

Verification

  • zig build -Doptimize=ReleaseSafe succeeds on this head; the built binary reports 0.0.8 and runs.
  • Local unit/e2e suites and Full CI have not been run yet for this head; this PR is a draft pending the Full CI run on all four native runners.

Required label: type: feature (external contributor cannot apply labels on this repo; please add it during review).

Add a fourth built-in provider that calls api.deepseek.com directly
with a user-supplied DEEPSEEK_API_KEY over the OpenAI Responses wire:
new deepseek, deepseek_api_key credential source, provider catalog and
CLI wiring (login/logout/provider/models), a curated model catalog for
deepseek-v4-flash/pro/vision-exp, and a permission reviewer on
deepseek-v4-flash. The transport omits OpenAI-only fields DeepSeek
ignores (include, service tier, parallel tool calls, verbosity), keeps
the plaintext reasoning items that thinking-mode tool loops must pass
back, and reuses the shared Responses reducer.

The reducer now treats the phase on output_item.done as authoritative
when it corrects a provisional phase from output_item.added; DeepSeek
announces final_answer at item start and completes the same item as
commentary before tool calls, which previously aborted every multi-turn
tool loop with ResponsesTextConflict.

Verified live against api.deepseek.com with a real key: provider
selection, model listing, a read_file tool round trip, and a multi-
round recovery session all complete; DeepSeek unit tests pass in
isolation. Full CI still to run on this branch.
@vercel-security-reviewer

Copy link
Copy Markdown

Security review details

@zhang0098
zhang0098 marked this pull request as ready for review September 8, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant