Dansk LLM

Using the API

Errors

What the errors mean and what to do about them.

An error has the same shape as OpenAI's, so the SDKs can read it:

{
  "error": {
    "message": "You exceeded your current quota. Add credits at https://platform.danskllm.dk to continue.",
    "type": "insufficient_quota",
    "param": null,
    "code": "insufficient_quota"
  }
}
StatuscodeMeaningWhat to do
400nullThe request is invalid. param points at the field when we can tell which.Fix the request.
400context_length_exceededThe prompt and the answer don't fit in the context window.Shorten the conversation or lower max_tokens.
401nullThere was no API key.Send the key in the Authorization header.
401invalid_api_keyThe key doesn't exist or was deleted.Create a new key on the platform.
401account_deactivatedThe account is blocked.Write to us.
404model_not_foundThe model doesn't exist or is turned off.See the models.
413nullThe request is larger than 2 MB.Send less text.
429insufficient_quotaThe balance is used up.Get more credit. Don't retry before then.
429rate_limit_exceededToo many requests at once, or too many refused keys from your IP address. See limits.Wait until a request has finished, or for the time in Retry-After.
503nullThe model is temporarily unavailable.Try again in a moment.
500nullAn error on our side.Try again. If it persists, write to us with the X-Request-ID from the response.

Retries

OpenAI's SDKs retry by themselves on status 429 and 5xx. With insufficient_quota we send the header x-should-retry: false, so they don't retry. With 503 we send Retry-After, so they know how long to wait.

Errors in the middle of a stream

Once a stream has started, the status is already 200. If the model stops answering along the way, the error arrives as the last event in the stream. See streaming.

On this page