GET STARTED
Make your first request
Create a key, select an available model, and send a chat request.
Setup
- Select the intended organization in the dashboard.
- Add prepaid credit in Billing and create an API key in API Keys. Copy the secret immediately; it is shown once.
- Store the key in your application's server-side environment as
NETRA_API_KEY. Choose an ID returned by the authenticated model list and setNETRA_MODELto that exact value. - Send a small request and confirm its usage appears in Observe.
These shell examples use a POSIX shell. On Windows, supply the same environment values with PowerShell's $env:NETRA_API_KEY and $env:NETRA_MODEL, or use the Python/JavaScript examples directly. Placeholder values must be replaced locally; never paste real secrets into documentation or an agent conversation.
Discover model IDs
curl --fail-with-body https://api.netraruntime.com/v1/models \
-H "Authorization: Bearer $NETRA_API_KEY"The result is an object with a data array. Set NETRA_MODEL to an available Chat Completions model's id.
Use deepseek/deepseek-v4.1-flash for DeepSeek V4.1 Flash, or deepseek/deepseek-v4-flash-0731 for DeepSeek V4 Flash 0731. The examples below use V4 Flash 0731; replace the model ID to use V4.1 Flash. See Models and pricing for current rates and capabilities.
For deepseek/deepseek-v4-flash-0731, add "reasoning": {"enabled": false} for thinking off, or "reasoning": {"effort": "high"} to request reasoning. In Python put this object in extra_body; the native reasoning_effort field remains compatible. Check the model's supported controls before changing effort or using a reasoning budget.
cURL
curl --fail-with-body https://api.netraruntime.com/v1/chat/completions \
-H "Authorization: Bearer $NETRA_API_KEY" \
-H "Content-Type: application/json" \
-H "X-Netra-Agent: quickstart" \
-d "{\"model\":\"$NETRA_MODEL\",\"messages\":[{\"role\":\"user\",\"content\":\"Explain an API in one sentence.\"}],\"max_tokens\":128,\"reasoning\":{\"enabled\":false}}"Python
Install the OpenAI SDK in your application's environment with pip install openai.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.netraruntime.com/v1",
api_key=os.environ["NETRA_API_KEY"],
max_retries=0,
)
response = client.chat.completions.create(
model=os.environ["NETRA_MODEL"],
messages=[{"role": "user", "content": "Explain an API in one sentence."}],
max_tokens=128,
extra_body={"reasoning": {"enabled": False}},
extra_headers={"X-Netra-Agent": "quickstart"},
)
print(response.choices[0].message.content)
print(response.usage)JavaScript / TypeScript
Install with npm install openai. Run this example in a server-side Node.js application configured for ES modules.
import OpenAI from "openai";
if (!process.env.NETRA_API_KEY || !process.env.NETRA_MODEL) {
throw new Error("Set NETRA_API_KEY and NETRA_MODEL before running.");
}
const client = new OpenAI({
baseURL: "https://api.netraruntime.com/v1",
apiKey: process.env.NETRA_API_KEY,
maxRetries: 0,
});
const response = await client.chat.completions.create({
model: process.env.NETRA_MODEL,
messages: [{ role: "user", content: "Explain an API in one sentence." }],
max_tokens: 128,
reasoning: { enabled: false },
}, { headers: { "X-Netra-Agent": "quickstart" } });
console.log(response.choices[0].message.content);
console.log(response.usage);These examples disable automatic SDK retries so you can decide whether a failed call should run again. Add bounded retries after implementing the request-ID guidance in Errors, limits, and retries.