Skip to main content
Neosantara AI provides a robust compatibility layer that enables you to use the official OpenAI SDKs to interact with our API. With only a few minor code changes, you can quickly evaluate Neosantara AI model capabilities or even migrate existing applications.
While this compatibility layer is fully supported, our priority remains the reliability and performance of the native Neosantara AI API. For the best experience and access to our complete feature set, we recommend using our modern /v1/responses endpoint.

Getting Started

To use the OpenAI SDK, you only need to change three things in your existing code:
  1. Update the base_url to point to Neosantara AI’s API endpoint.
  2. Replace your API key with a Neosantara AI API key.
  3. Update the model name to a Neosantara AI model.
The /v1/responses endpoint is our most powerful and modern API. Use client.responses.create() to access it.
from openai import OpenAI

client = OpenAI(
    api_key="<YOUR_NUSANTARA_API_KEY>",
    base_url="https://api.neosantara.xyz/v1"
)

response = client.responses.create(
    model="nusantara-base",
    input="Who are you?"
)

# Access the response text
print(response.output[0].text)

Quick Start: chat/completions API (Legacy)

The /v1/chat/completions endpoint is available for seamless compatibility with existing applications. Use client.chat.completions.create() to access it.
from openai import OpenAI

client = OpenAI(
api_key="<YOUR_NUSANTARA_API_KEY>",
base_url="https://api.neosantara.xyz/v1"
)

response = client.chat.completions.create(
model="nusantara-base",
messages=[
{"role": "user", "content": "Who are you?"}
],
)

print(response.choices[0].message.content)

Feature Compatibility Details

While we aim for maximum compatibility, there are some differences in how certain features are implemented.

System / Developer Messages

The concept of a system prompt is fully supported. For some underlying providers that don’t have a native system role, the content of your system message will be automatically prepended to the first user message to ensure the model follows your instructions.

Reasoning

Neosantara AI supports advanced reasoning through a special reasoning parameter available in both the /v1/responses and /v1/chat/completions endpoints.
# This parameter is supported by Neosantara AI
response = client.responses.create(
    model="nusantara-base",
    input="Solve this complex logic puzzle...",
    reasoning={"effort": "high"}
)

Conversation State (store)

The store: true and previous_response_id parameters are fully supported in the /v1/responses endpoint. This allows you to build stateful conversations without manually resending the entire chat history. This feature is not available for /v1/chat/completions.

Tools

The tools: {} is not supported on /v1/responses endpoint. Use the /v1/chat/completions instead.

Detailed Parameter Support

Most unsupported fields are silently ignored to prevent errors.
FieldSupport Status & Notes
modelFully supported. Use Neosantara AI model names.
messagesFully supported in /v1/chat/completions.
input / instructionsFully supported in /v1/responses.
max_tokensFully supported.
streamFully supported for both endpoints.
temperatureFully supported.
top_pFully supported.
stopFully supported.
presence_penaltyFully supported.
frequency_penaltyFully supported.
response_formatFully supported. json_schema is only available in /v1/responses.
tools / functionsFully supported. strict mode is handled on a best-effort basis by the underlying provider.
tool_choiceFully supported.
nIgnored. Only one choice (n=1) is supported.
logprobs / top_logprobsIgnored.
user / metadataIgnored.
seedIgnored.