Dansk LLM

API reference

Create chat completion

Sends a conversation to a model and returns its reply, in full or as a stream of server-sent events.

More about conversations, parameters and streaming under Chat completions.

curl https://api.danskllm.dk/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DANSKLLM_API_KEY" \
  -d '{
    "model": "muse-glimmer-30b",
    "messages": [
      {"role": "system", "content": "Du er en hjælpsom assistent."},
      {"role": "user", "content": "Forklar kort, hvad en API-nøgle er."}
    ]
  }'

Authorizations

Authorizationstringheaderrequired

Your API key, which starts with dkllm-.

Body

application/json
modelstringrequired

The model id, for example muse-glimmer-30b.

messagesobject[]required

The conversation so far.

Minimum array length: 1

Show child attributes
rolestringrequired

Available options: system, developer, user, assistant, tool

contentstring | object[] | null
Show child attributes
typestringrequired

Allowed value: "text"

textstringrequired
tool_callsobject[]

In an earlier reply from the model: the functions it called.

Show child attributes
idstring
typestring

Allowed value: "function"

functionobject
Show child attributes
namestring
argumentsstring

The arguments, as a JSON string.

tool_call_idstring

With role set to tool: the id of the call this message answers.

max_tokensinteger

The most tokens the reply may have.

max_completion_tokensinteger

Same as max_tokens.

temperaturenumber

How much replies vary. Higher is more varied.

top_pnumber

Nucleus sampling, an alternative to temperature.

stopstring | string[]

Text that makes the model stop.

seedinteger

Makes replies more alike from one request to the next.

ninteger

How many replies to generate. Each one is billed.

Required range: 1 <= x <= 4

presence_penaltynumber
frequency_penaltynumber
logit_biasobject
logprobsboolean
top_logprobsinteger
reasoning_effortstring

How much the model thinks before it answers. What each value does depends on the model; see the model's page.

Available options: none, low, medium, high

toolsobject[]

Functions the model may call, in OpenAI's format. Only for models with tool calling; see the model's page.

Show child attributes
typestringrequired

Allowed value: "function"

functionobjectrequired
Show child attributes
namestringrequired
descriptionstring
parametersobject

The arguments, as a JSON Schema.

tool_choicestring | object

Whether the model may or must call a function, and which.

Show child attributes
typestringrequired

Allowed value: "function"

functionobjectrequired
Show child attributes
namestringrequired
parallel_tool_callsboolean

Whether the model may call several functions in one reply.

response_formatobject

The form of the reply, for example {"type": "json_schema", ...} for JSON that follows a schema.

streamboolean

Send the reply as server-sent events while it is written.

stream_optionsobject
Show child attributes
include_usageboolean

Add a final event with usage and an empty choices list before [DONE].

Response

The reply. With stream set to true, a stream of chat.completion.chunk events that ends with data: [DONE].
idstring
objectstring

Allowed value: "chat.completion"

createdinteger
modelstring
choicesobject[]
Show child attributes
indexinteger
finish_reasonstring

stop when the reply is done, length when it hit max_tokens or the context window, tool_calls when the model calls functions.

logprobsobject | null
messageobject
Show child attributes
rolestring

Allowed value: "assistant"

contentstring | null

The answer. Empty when the model only calls functions.

reasoningstring | null

The model's thinking, for models that think. Not part of OpenAI's API.

tool_callsobject[]
Show child attributes
idstring
typestring

Allowed value: "function"

functionobject
Show child attributes
namestring
argumentsstring

The arguments, as a JSON string.

usageobject
Show child attributes
prompt_tokensinteger
completion_tokensinteger

The tokens of the reply, thinking included.

total_tokensinteger
prompt_tokens_detailsobject
Show child attributes
cached_tokensinteger

The part of the prompt that was read from the cache.