Meta tags:
description= The DeepSeek API uses an API format compatible with OpenAI/Anthropic. By modifying the configuration, you can use the OpenAI/Anthropic SDK or softwares compatible with the OpenAI/Anthropic API to access the DeepSeek API.;
Headings (most frequently used words):
api, your, first, call, integrate, with, agent, tools, invoke, the, chat,
Text of the page (most frequently used words):
deepseek (27), api (27), the (22), openai (17), content (9), you (9), model (8), anthropic (8), pro (7), chat (6), agent (6), stream (6), first (6), role (5), https (5), com (5), for (5), with (4), tools (4), completion (4), type (4), thinking (4), assistant (4), install (4), using (4), can (4), use (4), flash (4), your (4), call (4), main (3), false (3), high (3), reasoning_effort (3), enabled (3), are (3), helpful (3), system (3), messages (3), completions (3), deepseek_api_key (3), import (3), please (3), sdk (3), response (3), base_url (3), format (3), access (3), harness (3), github (2), invoke (2), integrate (2), models (2), pricing (2), message (2), choices (2), log (2), create (2), const (2), from (2), hello (2), user (2), client (2), get (2), api_key (2), json (2), curl (2), key (2), example (2), this (2), see (2), details (2), integrations (2), guide (2), and (2), code (2), has (2), been (2), updated (2), compatible (2), quick (2), start (2), beta (2), token (2), english (2), docs (2), copyright, 2026, inc, more, twitter, discord, email, community, wechat, official, account, next, console, await, function, async, env, process, apikey, baseurl, new, npm, print, extra_body, environ, pip3, authorization, bearer, application, nodejs, python, examples, refer, once, have, obtained, following, scripts, non, set, parameter, true, supported, many, popular, coding, like, claude, copilot, opencode, backend, directly, required, now, developer, preview, developers, worldwide, 0731, 0813, calling, method, remains, unchanged, simply, latest, version, apply, value, param, uses, modifying, configuration, softwares, page, change, faq, other, resources, news, reference, responses, context, caching, tool, calls, output, fim, prefix, multi, round, conversation, mode, guides, error, codes, rate, limit, isolation, usage, platform, skip,
Text of the page (random words):
your first api call deepseek api docs skip to main content deepseek api docs english english 中文 中国 deepseek platform quick start your first api call models pricing token token usage rate limit isolation error codes agent integrations api guides thinking mode multi round conversation chat prefix completion beta fim completion beta json output tool calls context caching using the responses api using the anthropic api api reference news other resources faq change log quick start your first api call on this page your first api call the deepseek api uses an api format compatible with openai anthropic by modifying the configuration you can use the openai anthropic sdk or softwares compatible with the openai anthropic api to access the deepseek api param value base_url openai https api deepseek com base_url anthropic https api deepseek com anthropic api_key apply for an api key model 1 deepseek v4 flash deepseek v4 pro 1 the deepseek v4 flash model has been updated to deepseek v4 flash 0731 and the deepseek v4 pro model has been updated to deepseek v4 pro 0813 the calling method remains unchanged simply use deepseek v4 flash or deepseek v4 pro to access the latest version integrate with agent tools deepseek harness is now in developer preview for agent harness developers worldwide see the deepseek harness guide for details the deepseek api is supported by many popular ai agent and coding assistant tools if you use tools like claude code github copilot or opencode you can use deepseek as the backend model directly no code required see the agent integrations guide for details invoke the chat api once you have obtained an api key you can access the deepseek model using the following example scripts in the openai api format this is a non stream example you can set the stream parameter to true to get stream response for examples using the anthropic api format please refer to anthropic api curl python nodejs curl https api deepseek com chat completions h content type application json h authorization bearer deepseek_api_key d model deepseek v4 pro messages role system content you are a helpful assistant role user content hello thinking type enabled reasoning_effort high stream false please install openai sdk first pip3 install openai import os from openai import openai client openai api_key os environ get deepseek_api_key base_url https api deepseek com response client chat completions create model deepseek v4 pro messages role system content you are a helpful assistant role user content hello stream false reasoning_effort high extra_body thinking type enabled print response choices 0 message content please install openai sdk first npm install openai import openai from openai const openai new openai baseurl https api deepseek com apikey process env deepseek_api_key async function main const completion await openai chat completions create messages role system content you are a helpful assistant model deepseek v4 pro thinking type enabled reasoning_effort high stream false console log completion choices 0 message content main next models pricing integrate with agent tools invoke the chat api wechat official account community email discord twitter more github copyright 2026 deepseek inc
|