Skip to content
PALM SOUQ

Model provider

DeepSeek logoPALM SOUQ for DeepSeek

DeepSeek's OpenAI-compatible API drops into PALM SOUQ with a base URL change. The gateway meters disk cache hits and misses and surfaces reasoner thinking output so low prices stay low per tenant.

One base URL change · tenant headers · <5 ms added
deepseek · setup
import os
from openai import OpenAI

deepseek = OpenAI(
    base_url="https://gateway.palmsouqltd.com/deepseek/v1",
    api_key=os.environ["DEEPSEEK_API_KEY"],
    default_headers={
        "X-PalmSouq-Key": os.environ["PALMSOUQ_KEY"],
        "X-PalmSouq-Tenant": tenant.id,
    },
)

resp = deepseek.chat.completions.create(
    model="deepseek-chat",
    messages=[{"role": "user", "content": "Extract the invoice fields"}],
)

Setup in one line

DeepSeek serves an OpenAI-compatible API, so the same OpenAI SDK you already use works against gateway.palmsouqltd.com/deepseek/v1. You keep your DeepSeek API key and model names (deepseek-chat and deepseek-reasoner). Tenant headers ride along on every request.

Because the request shape matches OpenAI, a single fallback chain can mix providers. A popular pattern routes a tenant from GPT-4.1 to DeepSeek V3.2 chat when the tenant crosses 90% of monthly budget, keeping capable answers at a fraction of the input price.

Context caching on disk

DeepSeek caches repeated prompt prefixes automatically and reports prompt_cache_hit_tokens and prompt_cache_miss_tokens in usage. Cache hits are billed at roughly a tenth of the miss rate. PALM SOUQ prices the two buckets separately and attributes them per tenant and per prompt template, so you can see which templates actually reuse their prefix.

There is no cache write premium on DeepSeek, which changes the economics compared with Anthropic. PALM SOUQ's cache tracker shows the break-even hit rate for each provider so teams can decide where to put long, stable system prompts.

Reasoner traffic and loop risk

deepseek-reasoner returns its chain of thought as reasoning_content alongside the final answer, and those tokens are billed as output. Reasoning models are also the ones most prone to self-reflection spirals in agent frameworks, where the agent asks the model to check its own answer over and over.

The semantic echo heuristic compares consecutive completions in a session and trips when they converge, and the step depth cap counts turns. Both apply to DeepSeek reasoner traffic. Low per-token prices make loops cheaper per call, but a loop that runs all night is still a line item someone has to explain.

Rolling it out safely

DeepSeek is often added as a lower-cost route rather than as the primary model, so the first step is usually a fallback rule, not a full migration. Add DeepSeek V3.2 as the budget fallback for one feature, set the downgrade threshold at 90%, and watch the audit log to see how often tenants reach it and whether answer quality complaints follow.

If the quality holds, teams then move whole low-stakes features, such as tagging or extraction, to DeepSeek as the primary model and keep the frontier model for the features customers notice.

Govern DeepSeek usage per tenant, starting today.

Route your agent traffic through PALM SOUQ in 2 minutes. Change one base URL, pass a tenant header, and every token is attributed and governed.

14-day free production trial · 100k requests included · no card required