"ChatGPT API" is what people usually call programmatic access to GPT models. When you work through llmbox, the request format and the official OpenAI SDK stay the same; only the API address and the key change. This guide covers your first requests with curl and Python, from checking the key to a streamed response. The lineup and rates are collected on the OpenAI models page.
Get a key
Create a key in the cabinet, in the Keys section, and save it in an environment variable. That keeps the key out of your code and your repository history.
export LLMBOX_API_KEY="sk-your-key"
Don't hardcode the key in browser or mobile code: it can be extracted from there. If requests come from a user interface, send them through your own server.
Choose a GPT model
A model name contains the generation and the tier. The generation is GPT-5.6 or GPT-6, and the tier is Astra, Sol, Terra or Luna. Start with the smallest suitable model and move up if the quality isn't enough.
The request takes the full model identifier from the catalog, for example openai/gpt-5.6-terra. You can get the full list with a GET /v1/models request using your key.
Send a request with curl
curl is a simple way to check that the key and address are correct. The request goes to /v1/chat/completions in the OpenAI Chat Completions format.
curl https://llmbox.cc/v1/chat/completions \
-H "Authorization: Bearer $LLMBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.6-terra",
"messages": [{"role": "user", "content": "How many planets are in the Solar System?"}]
}'
The Content-Type: application/json header is required: without it curl sends the body as a form, and you get a 415 error. The response is JSON like this:
{
"object": "chat.completion",
"model": "openai/gpt-5.6-terra",
"choices": [
{
"index": 0,
"message": {"role": "assistant", "content": "Eight."},
"finish_reason": "stop"
}
],
"usage": {"prompt_tokens": 16, "completion_tokens": 3, "total_tokens": 19}
}
The model's answer is in choices[0].message.content. The usage field shows input and output tokens, which determine the cost of the request.
Repeat the request in Python
Install the official SDK with pip install openai. The client needs two parameters: the API address and the key.
import os
from openai import OpenAI
client = OpenAI(base_url="https://llmbox.cc/v1", api_key=os.environ["LLMBOX_API_KEY"])
resp = client.chat.completions.create(
model="openai/gpt-5.6-terra",
messages=[{"role": "user", "content": "How many planets are in the Solar System?"}],
)
print(resp.choices[0].message.content)
print(resp.usage.total_tokens)
If you set the OPENAI_BASE_URL and OPENAI_API_KEY variables instead of passing parameters, the client reads them itself, and the creation line shrinks to OpenAI().
Set a role and response options
A system message sets the model's role, tone and answer format. The max_tokens parameter limits the length of the answer, and reasoning_effort controls the depth of reasoning. GPT-5.6 models support levels from none to max. On simple questions, none noticeably reduces usage, while high levels suit tasks where the model needs to plan. This and the following Python examples use the client from the previous step.
resp = client.chat.completions.create(
model="openai/gpt-5.6-terra",
messages=[
{"role": "system", "content": "You are an editor. Answer briefly, as a list."},
{"role": "user", "content": "How can I make an email clearer?"},
],
max_tokens=300,
reasoning_effort="none",
)
print(resp.choices[0].message.content)
The model doesn't remember earlier requests. To continue a conversation, add the previous questions and answers to messages with the user and assistant roles and send the whole history again.
Get the response as a stream
To make the text appear as it is generated, add "stream": true. The response arrives as a Server-Sent Events stream. If you enable include_usage, the last event contains the token counts.
stream = client.chat.completions.create(
model="openai/gpt-5.6-terra",
messages=[{"role": "user", "content": "Tell me a short story"}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage:
print("\nTokens:", chunk.usage.total_tokens)
The -N flag turns off curl's buffering; otherwise all the chunks are printed only at the end.
Try the Responses API
Besides Chat Completions, GPT models work in the Responses format, which Codex CLI is built on. In this format, all OpenAI text models call functions, including GPT-6.1 Sol. GPT models can also search the web here with the built-in web_search tool: the model reads the pages it finds as input tokens, with no separate charge for the search.
resp = client.responses.create(
model="openai/gpt-5.6-sol",
instructions="Answer briefly.",
input="How many planets are in the Solar System?",
max_output_tokens=2000,
)
print(resp.output_text)
The max_output_tokens limit is set with some headroom: reasoning tokens count as output, and with too low a limit the model can use it all on reasoning before it starts answering. Responses uses different parameter names: instructions instead of the system message, max_output_tokens instead of max_tokens, and reasoning.effort instead of reasoning_effort. Pass the conversation history in input with every request.
Estimate usage
The cost of a request is the sum of input and output tokens at the model's rates. Reasoning tokens count as output. Every request with its status, tokens and cost is visible in the Logs section of the cabinet, and the calculator below estimates monthly usage at the catalog's current rates.
If a request fails, the response contains an error code. The most common are 401 invalid_api_key (the key is missing or revoked), 404 model_not_found (a typo in the model identifier) and 429 (too many requests; the SDK automatically retries after a pause). All the codes are explained in the Errors section of the documentation.
Questions
Do I need an OpenAI account and key?
No. Requests to GPT models use your llmbox key from the cabinet. The same key works with models from other vendors in the catalog.
How is the ChatGPT API different from the ChatGPT app?
The app is a ready-made chat for a user. The API is programmatic access to GPT models from your code, scripts and services, billed by tokens.
Which GPT model should I pick for a first project?
For a chatbot or data extraction, GPT-5.6 Terra; for bulk labeling and short answers, GPT-5.6 Luna or GPT-6 Luna. If the result isn't good enough, move up to a larger model by changing one line.
Why does GPT-6.1 Sol call functions only in Responses?
It is a property of the model: according to OpenAI's documentation, it calls functions only in the Responses API. For functions in Chat Completions, use the GPT-5.6 models and GPT-6 Astra.
Does the same thing work in Node.js?
Yes. The official openai package for Node takes the same parameters: baseURL, apiKey and model. There is an example in the SDK section of the documentation.
Published November 15, 2026


