Chat Completions
Call the available OpenAI-compatible inference endpoint with a stable model ID and a retry-safe request key.
Endpoint
POST /v1/chat/completionsThe request must include a bearer API key. Idempotency-Key is optional for compatibility with standard OpenAI SDKs; when omitted, OurToken generates a UUID v4 for the request and returns it in the response header. Send your own UUID v4 when you need retry-safe replay after an uncertain response.
{
"model": "deepseek/deepseek-v4-flash",
"messages": [
{ "role": "user", "content": "Summarize this note." }
]
}Response
OurToken returns an OpenAI-compatible chat completion. The model field is always the official public ID that you requested, not a provider or route identifier.
{
"id": "chatcmpl_…",
"object": "chat.completion",
"model": "deepseek/deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "…" },
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 184,
"completion_tokens": 63,
"total_tokens": 247,
"customer_charge_micros": 0
}
}customer_charge_micros is the final settled charge in millionths of the wallet currency. The record retains normalized meters and the price snapshot used for settlement; it does not retain your prompt or completion content in the billing ledger.
Function tools
The endpoint accepts OpenAI-compatible function tools through tools, tool_choice, and parallel_tool_calls. Assistant messages may return tool_calls; send each tool result back as a role: "tool" message with its matching tool_call_id.
deepseek/deepseek-v4-flash supports automatic tool choice. Its thinking mode does not support forced tool_choice: "required" or a specifically named forced function.
Streaming and request options
Set stream: true to receive OpenAI-compatible chat.completion.chunk server-sent events followed by data: [DONE]. Text deltas, function-tool call IDs, names, fragmented argument strings, finish reasons, and terminal usage are relayed as they arrive.
The bounded JSON body accepts additional Chat Completions options such as metadata, response_format, penalties, stop, logprobs, and stream_options, and passes them to the active compatible provider. Individual models and upstream providers may not implement every OpenAI option.
If the client disconnects before provider completion, OurToken cancels the upstream request and releases the wallet hold. If provider work has already completed, terminal usage is settled before the stream emits [DONE].
Compatibility boundary
This endpoint is OpenAI-compatible for Chat Completions. Support for another OpenAI endpoint or protocol is not implied by that compatibility.