EN ▾
Create key

ApiCoderDeepSeek coder api: Quickstart Guide

DeepSeek coder api: Quickstart Guide

Connect your existing tools to an uncensored, OpenAI-compatible API by updating your base URL and API key. This guide helps you start generating code and text immediately with predictable performance.

Installation and Base URL Configuration

Update your client configuration to point at our hosted endpoint. The base_url must change from the default provider to https://api.apicoderdeepseek.com/v1 to route requests correctly.

  • Set base_url to the value above.
  • Keep the SDK standard as-is for compatibility.

This single change ensures all subsequent calls hit our uncensored model directly. No proxy layer means you get consistent latency without extra hops.

Authentication and Header Setup

Pass your key in the Authorization header to verify access. Create an account via Google or email to receive your unique credential instantly.

Include the header Authorization: Bearer YOUR_API_KEY in every request. Our system validates this token before processing any tokens or calculating usage costs.

Sending Your First Chat Completion Request

Send a standard chat completion request to generate text or code. Use the model ID uncensored to access the tuned model without content refusals.

The API accepts standard OpenAI payload structures. You can send system prompts, user messages, and assistant history in a single call.

Ensure your request body includes the model and messages fields. The response will contain the generated text in the content field.

Streaming Responses and Token Usage

Enable streaming by setting stream to true in your request. The API returns chunks via Server-Sent Events (SSE) for real-time output.

The final chunk contains token usage details for billing transparency. You can track input and output tokens as they arrive.

This approach reduces perceived latency for long responses. Developers prefer streaming for coding assistants and interactive applications.

Function Calling and JSON Mode Examples

Use response_format set to json_object for structured outputs. This ensures the model returns valid JSON instead of markdown text.

Define function schemas in the tools parameter. The model will call these functions when appropriate based on the prompt.

Supports temperature, top_p, and stop parameters for fine-tuning output. Use seed for reproducible results during testing.

Rate Limits and Error Handling

Monitor your request rate to avoid throttling. The API allows 300 requests per minute per key and 8 concurrent requests.

Handle HTTP 401 for invalid keys and 429 for rate limits. Requests under 8 MB are supported. Errors do not consume credit.

The context window supports up to 100,000 tokens total. Max output is 16,000 tokens unless max_tokens is set to 2,048 by default.

cURL

curl https://api.apicoderdeepseek.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the available endpoints for the chat completion service."}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.apicoderdeepseek.com/v1", api_key="YOUR_KEY")

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Node.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.apicoderdeepseek.com/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Streaming

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Frequently asked questions

What is the deepseek coder API context window?

The context window supports up to 100,000 tokens for both prompt and completion combined. Max output per request is 16,000 tokens, or 2,048 if not specified.

How do I handle errors like 401 or 429?

A 401 error means your API key is invalid or missing. A 429 error indicates you have exceeded the 300 requests per minute limit. Both errors do not consume your prepaid credit.

Is this the official deepseek API?

No, this is an independent service running an uncensored open-weight model. It is compatible with OpenAI SDKs but does not serve the official DeepSeek, GPT, or other vendor models.

Generate your API key

Register, copy the key, and point to the new base URL. Done.