No KYC — no ID, no selfie, no documents. Pay in crypto: BTC, USDT, USDC, ETH, SOL, LTC
Language: English
Get an API key

Docs · API reference

Chat completions endpoint: POST /api/v1/chat/completions

One endpoint answers every model. It takes the same body as the OpenAI chat completions API and returns the same object, so an existing integration needs a new base URL, a new key and a model id from our list.

Last updated: · 6 min read

Quick answer

Which fields does the chat completions endpoint of LLMwithCrypto accept?

It accepts the OpenAI chat completions body: model and messages are required; max_tokens, temperature, top_p, stop, stream, stream_options, tools, tool_choice and response_format are optional. LLMwithCrypto returns a chat.completion object with a usage count, billed per token from your credit, as documented on 23 October 2026. Tool calling and JSON output depend on the model.

The endpoint at a glance

Method and URLPOST https://llmwithcrypto.com/api/v1/chat/completions
AuthenticationPass your API key as a Bearer token in the Authorization header, as the OpenAI SDK does
BodyJSON, Content-Type: application/json
Responsechat.completion object, or server-sent events with stream: true
BillingYou pay per token from your balance: input and output tokens are counted by the model’s own tokenizer and charged at that model’s price per 1M tokens. A call that ends in an error costs nothing
FeaturesStreaming works on every model; tool calling and JSON output follow what each model itself supports

Create a chat completion

POST/api/v1/chat/completions

Sends a conversation to one model and returns its answer with the token counts. The example asks DeepSeek V4 Pro a short question with a 200-token cap; ids, times and counts in the response are illustrative.

Authentication: API key in the Authorization: Bearer API_KEY header.

Request body

FieldTypeRequiredDescription
modelstringYesThe model id, such as deepseek-v4-pro or gpt-oss-120b. GET /api/v1/models returns every id your key can call.
messagesobject[]YesThe conversation, oldest first. Each item has a role (system, user, assistant or tool) and a content string; tool messages also carry a tool_call_id.
max_tokensintegerNoThe most tokens the answer may use. Without it, the model may write until its context window is full, and you pay for every token it writes.
temperaturenumberNo0 to 2. Lower is more predictable, higher more varied. The default depends on the model.
top_pnumberNo0 to 1, nucleus sampling. Change temperature or top_p, not both.
stopstring or string[]NoUp to 4 sequences that end the answer when the model writes them. They are not included in the answer.
streambooleanNotrue sends the answer as server-sent events, piece by piece. See streaming.
stream_optionsobjectNo{"include_usage": true} adds a last event with the usage of a streamed call.
toolsobject[]NoFunctions the model may ask you to call, in the OpenAI format. Works on the models that support tool calling. See tool calling.
tool_choicestring or objectNoauto (default when tools is set), none, required, or {"type": "function", "function": {"name": "…"}}.
response_formatobjectNo{"type": "json_object"} asks for a valid JSON object, on the models that support it. Say in your prompt what the JSON should contain.
Example: a short answer from DeepSeek V4 Pro
{
  "model": "deepseek-v4-pro",
  "messages": [
    {
      "role": "system",
      "content": "Answer in two sentences."
    },
    {
      "role": "user",
      "content": "What is a context window?"
    }
  ],
  "max_tokens": 200
}
Example: a JSON object from gpt-oss-120b, low temperature
{
  "model": "gpt-oss-120b",
  "messages": [
    {
      "role": "user",
      "content": "Return {\"city\": string, \"country\": string} for the Eiffel Tower."
    }
  ],
  "response_format": {
    "type": "json_object"
  },
  "temperature": 0.2,
  "max_tokens": 100
}

Response 200

{
  "id": "chatcmpl-8f2c41d0a7b94e1c",
  "object": "chat.completion",
  "created": 1792742400,
  "model": "deepseek-v4-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A context window is the maximum number of tokens a model can read and write in one request. Anything beyond it must be cut or summarized before the call."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 27,
    "completion_tokens": 34,
    "total_tokens": 61
  }
}

Code examples

curl
curl -s "https://llmwithcrypto.com/api/v1/chat/completions" \
  -H "Authorization: Bearer $LLMWITHCRYPTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {"role": "system", "content": "Answer in two sentences."},
      {"role": "user", "content": "What is a context window?"}
    ],
    "max_tokens": 200
  }'
Python
import os

from openai import OpenAI

client = OpenAI(
    base_url="https://llmwithcrypto.com/api/v1",
    api_key=os.environ["LLMWITHCRYPTO_API_KEY"],
)

resp = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "system", "content": "Answer in two sentences."},
        {"role": "user", "content": "What is a context window?"},
    ],
    max_tokens=200,
)
print(resp.choices[0].message.content)
print(resp.usage.prompt_tokens, "in,", resp.usage.completion_tokens, "out")
Node.js
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://llmwithcrypto.com/api/v1',
  apiKey: process.env.LLMWITHCRYPTO_API_KEY,
});

const resp = await client.chat.completions.create({
  model: 'deepseek-v4-pro',
  messages: [
    { role: 'system', content: 'Answer in two sentences.' },
    { role: 'user', content: 'What is a context window?' },
  ],
  max_tokens: 200,
});
console.log(resp.choices[0].message.content);
console.log(resp.usage.prompt_tokens, 'in,', resp.usage.completion_tokens, 'out');

How do I write the messages?

Send the whole conversation every time, oldest message first: the API keeps no memory between calls, and nothing of your prompts is stored. We do not store your prompts or the model’s answers: once a response is sent, its text is gone. Each call leaves one log line with the time, the account, the model and the token counts, deleted after 30 days.

  • system: instructions that frame every answer, such as tone, language or output format. Put one at the top.
  • user: what the person or your program asks.
  • assistant: the model’s earlier answers, so it can continue the conversation.
  • tool: the result of a function the model asked you to run, with the tool_call_id it gave you.

Every message counts as input tokens, so long histories cost more on each turn. Trim or summarize old turns when a conversation grows.

How long can a request be?

Input and output together must fit in the model’s context window. As of 23 October 2026, DeepSeek V4 Pro reads up to 1M tokens, gpt-oss-120b up to 128K and Qwen3 235B up to 256K; the models page lists all of them.

A request that does not fit comes back as 400 with the code context_length_exceeded and costs nothing. Set max_tokens so that the prompt plus the longest answer you accept stays inside the window.

What does finish_reason tell me?

finish_reasonMeaningWhat to do
stopThe model ended its answer, or wrote one of your stop sequencesNothing: the answer is complete
lengthThe answer reached max_tokens or the context windowRaise max_tokens, or ask for a shorter answer
tool_callsThe model wants you to run one or more functionsRun them and send the results back, see tool calling

Which OpenAI parameters are not supported?

The fields in the table above are the whole contract. Others from the OpenAI API, such as n (several answers per call), logprobs, audio or image inputs, are not supported: send only the fields listed here. The models are text models; none of them takes images through this endpoint.

The model field only takes the ids on our list. We do not sell access to GPT, Claude, Gemini or Grok: their makers forbid reselling API access without their approval, and we do not have it.

Chat completions: common questions

Is there a legacy completions endpoint?

No. Only the chat format exists; a single prompt is a messages array with one user message.

What does a call cost?

You pay per token from your balance: input and output tokens are counted by the model’s own tokenizer and charged at that model’s price per 1M tokens. A call that ends in an error costs nothing. Per-model prices are on the pricing page.

Can I see my past requests?

No, by design. We do not store your prompts or the model’s answers: once a response is sent, its text is gone. Each call leaves one log line with the time, the account, the model and the token counts, deleted after 30 days.

Why did my answer stop in the middle?

finish_reason is then length: the answer hit max_tokens. Raise it, within the model’s context window.

DeepSeek V4 Pro from $1.254 per 1M input tokens · no KYC

Get an API key