Docs Menu & Search
Documentation
Request Parameters
Which chat request fields nabh.cloud checks, which it passes to the model, and the defaults.
POST /v1/chat/completions takes the same body as OpenAI’s Chat Completions API. nabh.cloud checks a few fields itself, because they decide what a request can cost. Every other field goes to the model exactly as you sent it.
Fields nabh.cloud Checks
| Field | Rule |
|---|---|
model | Required. A model ID from Models. If your plan doesn’t include the model, the request returns 403 PERMISSION_DENIED. |
max_tokens, max_completion_tokens | Optional. The most output tokens to generate: a whole number from 1 to 32,000. With neither field, the cap is 4,096. If you send both, max_completion_tokens wins. Any other value returns 400 INVALID_REQUEST; a value is never silently lowered. |
n | Optional. How many answers to generate, from 1 to 8 (default 1). Every answer is billed. |
stream | true streams the answer as server-sent events. nabh.cloud adds stream_options: {"include_usage": true}, so the last chunk carries the token counts. See Streaming. |
Before a request starts, your balance must cover an estimate of the input plus the full output cap for every answer, so a lower max_tokens needs fewer credits to begin. You’re billed only for the tokens actually used.
Fields Passed to the Model
temperature, top_p, stop, seed, presence_penalty, frequency_penalty, logit_bias, tools, tool_choice, response_format and any other field go to the model unchanged. nabh.cloud sets no defaults of its own for them: each model uses its own.
Support varies by model. A field one model honours, another may ignore. For tools and JSON output, each model’s page shows Supported, Not Supported or Unverified; seeTools & Structured Output.
curl https://api.nabh.cloud/v1/chat/completions \
-H "Authorization: Bearer nbh_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-oss-20b",
"messages": [{"role": "user", "content": "Give me three names for a chai stall."}],
"temperature": 0.9,
"top_p": 0.95,
"max_tokens": 300,
"stop": ["4."]
}'from openai import OpenAI
client = OpenAI(api_key="nbh_your_key_here", base_url="https://api.nabh.cloud/v1")
resp = client.chat.completions.create(
model="gpt-oss-20b",
messages=[{"role": "user", "content": "Give me three names for a chai stall."}],
temperature=0.9,
top_p=0.95,
max_tokens=300,
stop=["4."],
)
print(resp.choices[0].message.content)Reasoning Models
Models tagged Reasoning may think before they answer, and thinking tokens count toward max_tokens and are billed as output. Leave room for them: 2,000 or more, or leave max_tokens unset. A reply cut off by the cap ends with finish_reason: "length".
medha returns its thinking in reasoning_content and the answer in content. For a faster, cheaper answer, turn thinking off for one request:
{
"model": "medha",
"messages": [{ "role": "user", "content": "Translate 'good morning' into Hindi." }],
"chat_template_kwargs": { "enable_thinking": false }
}Other Endpoints
- Embeddings, images and audio have their own fields. SeeEmbeddings, Images & Audio. Image generation takes
nfrom 1 to 10. - Image input uses the chat request above, with images in the message content. SeeImage Input (Vision).