API
Chat Completions
OpenAI Chat Completions. Point an OpenAI SDK at https://inference.dagon.so/v1 and call it as usual.
On this page
Request
POST/v1/chat/completions
curl https://inference.dagon.so/v1/chat/completions \
-H "Authorization: Bearer $DAGON_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "abliterated-model-large-flash",
"messages": [{"role": "user", "content": "Explain this stack trace."}],
"max_tokens": 1024
}'# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://inference.dagon.so/v1", api_key=os.environ["DAGON_KEY"])
reply = client.chat.completions.create(
model="abliterated-model-large-flash",
messages=[{"role": "user", "content": "Explain this stack trace."}],
max_tokens=1024,
)
print(reply.choices[0].message.content)// npm install openai
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://inference.dagon.so/v1", apiKey: process.env.DAGON_KEY });
const reply = await client.chat.completions.create({
model: "abliterated-model-large-flash",
messages: [{ role: "user", content: "Explain this stack trace." }],
max_tokens: 1024,
});
console.log(reply.choices[0].message.content);Forwarded fields
Only documented fields whose cost the meter can see are forwarded: model, messages, max_tokens, max_completion_tokens, n, stream, stream_options, temperature, top_p, stop, presence_penalty, frequency_penalty, logit_bias, logprobs, top_logprobs, seed, response_format, tools, tool_choice, parallel_tool_calls, functions, function_call, reasoning_effort, verbosity, prompt_cache_key, store, metadata, user, safety_identifier. Any other non-null field is 400 unsupported_parameter (null fields are dropped).
- Output cap.
max_completion_tokenswins overmax_tokens, and only the checked one is forwarded. Without either, 16,384 is written for you. n: 1 to 8, chat only. It multiplies the hold.- Tools. Only client-executed
function(orcustom) tools.tool_choicemay benone,auto,requiredor name one of the request's own functions. - Images.
image_urlparts with adata:image/…;base64,URL or an http(s) URL, on models whoseinput_modalitiesincludeimage.
Not available
Server-run tools (web search, code execution, file search, MCP, image generation), audio output, prediction, service_tier and content stored upstream (file_id) are refused: none can be priced per token. Web search is 400 web_search_not_supported.
Response
The provider's OpenAI-format body, unchanged, with these headers added:
| Header | Value |
|---|---|
x-gateway-request-id | The gateway's id for this request; quote it to support. |
x-gateway-receipt-id | The receipt id; fetch it at GET /v1/receipts/:id. |
x-gateway-receipt | Non-streaming only: the signed receipt itself, base64url JSON. |
Reading headers with the SDKs:
raw = client.chat.completions.with_raw_response.create(
model="abliterated-model-large-flash", messages=[{"role": "user", "content": "Hi"}], max_tokens=200,
)
print(raw.headers.get("x-gateway-receipt-id"))
reply = raw.parse()const { data, response } = await client.chat.completions
.create({ model: "abliterated-model-large-flash", messages: [{ role: "user", content: "Hi" }], max_tokens: 200 })
.withResponse();
console.log(response.headers.get("x-gateway-receipt-id"));Last updated