DEVUP Docs
Back to Dashboard

Chat Completions

DEVUP AI provides an OpenAI-compatible Chat Completions endpoint for supported chat models. Note that feature and parameter support may vary by model.

POST
https://api.devupai.com/v1/chat/completions
For the modern Responses-style request interface, see Responses API.

Choose your SDK

npm install devupai

The DEVUP AI SDK provides native access to the platform. OpenAI SDKs can be used with the OpenAI-compatible endpoint by configuring the DEVUP AI base URL, API key, and model identifier.

Basic chat completion

By setting the baseURL and passing your DEVUP AI token, you can send requests directly to our optimized inference infrastructure.

from openai import OpenAI

openai = OpenAI(
    api_key="$DEVUP_API_KEY",
    base_url="https://api.devupai.com/v1",
)

chat_completion = openai.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[{"role": "user", "content": "Hello!"}],
)

print(chat_completion.choices[0].message.content)
print(chat_completion.usage.prompt_tokens, chat_completion.usage.completion_tokens)

Multi-turn conversations

Models do not store memory. To maintain conversational state, you must pass the entire conversation history in the messages array on each request.

from openai import OpenAI

openai = OpenAI(
    api_key="$DEVUP_API_KEY",
    base_url="https://api.devupai.com/v1",
)

chat_completion = openai.chat.completions.create(
    model="deepseek-ai/DeepSeek-V4-Pro",
    messages=[
        {"role": "system", "content": "Respond like a michelin starred chef."},
        {"role": "user", "content": "Can you name at least two different techniques to cook lamb?"},
        {"role": "assistant", "content": "Bonjour! Let me tell you, my friend, cooking lamb is an art form..."},
        {"role": "user", "content": "Tell me more about the second method."},
    ],
)

print(chat_completion.choices[0].message.content)

Supported parameters

We support the majority of standard OpenAI chat completion parameters.

Required

model
string•required

ID of the model to use. See the model library for all available options. The model must be served on this endpoint: an image, speech, video, embedding or reranking model returns HTTP 400 wrong_endpoint, naming the endpoint that serves it, and the request is not billed.

messages
array•required

A list of messages comprising the conversation so far. When the last message in the conversation is from the assistant, the model answers with a new assistant message. On some models this needs a short user message: "Continue." is then added, with a notice in _devup.warnings. A model that cannot answer such a conversation returns HTTP 400 conversation_must_end_with_user before any charge.

Generation controls

max_tokens
integer•optional•range: 1 - max_output_tokens

The maximum number of tokens that can be generated in the chat completion. The largest accepted value, for max_tokens and max_completion_tokens, is the model's own max_output_tokens in GET /v1/models; a larger value returns HTTP 400 invalid_max_tokens. When neither is sent, the reply is limited to the model's default output length, which is at most its max_output_tokens. Reasoning models spend part of this budget thinking before they answer. With images, audio or video in the request, set it high enough — 2000 or more is a safe start — or the reply can come back empty with finish_reason "length".

temperature
number•optional•default: 1•range: 0 - 2

What sampling temperature to use. Higher values make output more random, lower values make it more focused.

top_p
number•optional•default: 1•range: 0 - 1

An alternative to sampling with temperature, called nucleus sampling.

stop
string / array•optional

Up to 4 sequences where the API will stop generating further tokens.

presence_penalty
number•optional•default: 0•range: -2.0 - 2.0

Positive values penalize new tokens based on whether they appear in the text so far.

frequency_penalty
number•optional•default: 0•range: -2.0 - 2.0

Positive values penalize new tokens based on their existing frequency in the text so far.

Streaming

stream
boolean•optional•default: false

If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events.

Structured output & tools

response_format
object•optional

An object specifying the format that the model must output. Compatible with JSON mode and structured outputs. On a model that returns JSON inside a Markdown code fence, the fence around the whole reply is removed, with the notice json_fence_removed. On a model that does not apply json_schema itself but enforces tool calls, a json_schema request without streaming is answered through a forced tool call and returned as message.content (notice structured_output_via_tool); with strict: true, a reply that does not match the schema returns structured_output_mismatch.

tools
array•optional

A list of tools the model may call, and controls for which tool is called.

tool_choice
string / object•optional

Controls which tool is called by the model.

parallel_tool_calls
boolean•optional

Set to false to ask the model for at most one tool call per reply. Send it together with tools: on some models it is left out without tools, with the notice parameter_not_supported. tool_calls.parallel in GET /v1/models is true for models that can return several tool calls in one reply. See parallel tool calls.

reasoning_effort
string•optional

How much the model reasons before answering, for example low, medium or high. When known, reasoning.values in GET /v1/models lists the reasoning levels you can send to the model with reasoning.parameter, from least to most reasoning. none, when listed, turns reasoning off. How much each level changes the reasoning depends on the model. Some models list a single value, which turns reasoning on. Reasoning tokens count as output tokens.

reasoning
object•optional

{"enabled": true} asks for reasoning. On models that take reasoning_effort, it is applied as reasoning_effort "medium", with a notice in _devup.warnings; when reasoning_effort is also sent, reasoning_effort wins. {"enabled": false} does not turn reasoning off on those models: the model reasons at its default level, with a notice.

Supported parameters and behavior may vary by model. A model's reasoning arrives in its own field, reasoning_content (delta.reasoning_content when streaming), separate from content.

Max output tokens

Model limits

Each model has its own limit on how many output tokens it can generate in a single request: its max_output_tokens in GET /v1/models. A larger max_tokens or max_completion_tokens returns HTTP 400 invalid_max_tokens, with a message that names the parameter you sent and the model's limit. When you send neither, the reply is limited to the model's default output length, which is at most its max_output_tokens, or less when the prompt leaves less room in the model's context window.

Continuing responses

If a model stops generating because it reached the limit, the finish_reason will be length. You can send the truncated response back as an assistant message and the model will continue right where it left off.

Note: The model may repeat or overlap slightly when continuing. It is not always a completely seamless continuation.

bash
curl -X POST https://api.devupai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DEVUP_API_KEY" \
  -d '{
    "model": "deepseek-ai/DeepSeek-V4-Pro",
    "messages": [
      {
        "role": "user",
        "content": "Write a 5,000 word essay on quantum physics."
      },
      {
        "role": "assistant",
        "content": "<previous truncated response>"
      }
    ]
  }'

What's Next