> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gnani.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating from OpenAI

> Move code written for OpenAI's Chat Completions API to Gnani by changing the base URL and the API key.

Early access
**Gnani Evon v3.5** is now available as an API to early access registrants.

## Overview

The LLM API follows **OpenAI's Chat Completions API**. Most code written for OpenAI works unchanged: you point the client at Gnani, use your Gnani API key, and set `model` to `evon-v3.5`.

This page lists what works the same, what works differently, and what is not supported.

***

## Change two lines

```python Python (OpenAI SDK) theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENAI_API_KEY"],  # [!code --]
    base_url="https://api.vachana.ai/v1",  # [!code ++]
    api_key=os.environ["GNANI_API_KEY"],  # [!code ++]
)

completion = client.chat.completions.create(
    model="gpt-4o-mini",  # [!code --]
    model="evon-v3.5",  # [!code ++]
    messages=[{"role": "user", "content": "Summarise UPI in one sentence."}],
)
print(completion.choices[0].message.content)
```

```javascript JavaScript (OpenAI SDK) theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY, // [!code --]
  baseURL: "https://api.vachana.ai/v1", // [!code ++]
  apiKey: process.env.GNANI_API_KEY, // [!code ++]
});

const completion = await client.chat.completions.create({
  model: "gpt-4o-mini", // [!code --]
  model: "evon-v3.5", // [!code ++]
  messages: [{ role: "user", content: "Summarise UPI in one sentence." }],
});
console.log(completion.choices[0].message.content);
```

The SDK sends the key as `Authorization: Bearer <key>`, which the API accepts.

> [!WARNING]
>
> **Thinking is on by default**, unlike most OpenAI chat models. The thinking counts toward `max_tokens`, which is 1,024 on Free and Pay-as-you-go plans. For quick answers, send `reasoning_effort="none"`. See [Thinking](https://docs.gnani.ai/api/LLM/thinking.md).

***

## What is supported

### Supported

These work as they do in OpenAI's API. Value ranges are on the [Chat Completions](https://docs.gnani.ai/api/LLM/chat-completions.md) page.

| Feature | Notes |
| - | - |
| `POST /v1/chat/completions` | The only endpoint. |
| `messages` with `system`, `developer`, `user`, `assistant` and `tool` roles | `developer` means the same as `system`. |
| Text content, as a string or a list of text parts | |
| `model` | `evon-v3.5`. It is the default. |
| `stream`, `stream_options.include_usage` | See [Streaming](https://docs.gnani.ai/api/LLM/streaming.md). |
| `max_tokens`, `max_completion_tokens` | If you send both, they must be equal. |
| `temperature`, `top_p`, `stop`, `seed`, `frequency_penalty`, `presence_penalty` | |
| `tools` (functions), `tool_choice` `auto` / `none` / a named function, `parallel_tool_calls` | See [Tool calling](https://docs.gnani.ai/api/LLM/tool-calling.md). |
| `response_format` `text`, `json_object`, `json_schema` | See [JSON output](https://docs.gnani.ai/api/LLM/structured-outputs.md). |
| `user` | For your own tracking. |
| HTTP status codes | Match OpenAI's, so the SDKs raise their usual exceptions. |

### Supported with differences

| Feature | Gnani LLM API |
| - | - |
| Thinking | On by default. The thinking is returned in `message.reasoning` and counts as output tokens. See [Thinking](https://docs.gnani.ai/api/LLM/thinking.md). |
| `reasoning_effort` | `none` turns thinking off. `minimal`, `low`, `medium` and `high` leave it on, and do not change how long the model thinks. |
| `tool_choice: "required"` | Allowed only with exactly one tool. With several tools, name the function to call, or use `auto`. |
| Forced function calls | A reply that calls the function you forced can have `finish_reason: "stop"` rather than `tool_calls`. Check whether `message.tool_calls` is non-empty. |
| `n` | Only `1`. One reply per request. |
| `max_tokens` | Capped by your plan: 1,024 on Free and Pay-as-you-go plans. See [Limits](https://docs.gnani.ai/api/LLM/limits.md). |
| Rate-limit and authentication errors | Use the gateway's `{"detail": {...}}` shape. See [Errors](https://docs.gnani.ai/api/LLM/errors.md). |
| Safety | Requests are screened for prompt injection, and personal data in replies is masked. See [Safety and privacy](https://docs.gnani.ai/api/LLM/safety.md). |

### Not supported

| Feature | Gnani LLM API |
| - | - |
| Other models | Only `evon-v3.5`. Another name returns `404 model_not_found`. |
| Image, audio and file content parts | Refused. An image part returns `400 model_rejected_request` (`evon-v3.5` is not a multimodal model). |
| `n` greater than `1` | Refused with `400 invalid_request`: "n greater than 1 is not supported." |
| `logprobs`, `top_logprobs`, `logit_bias` | Accepted and ignored. The reply has no log probabilities. |
| `audio` (output audio) | Refused with `400 unsupported_parameter`: "audio is not supported: the model has no audio output". `audio: null` is accepted. |
| `modalities`, `prediction` | Accepted and ignored. |
| `store`, `metadata`, `service_tier` | Accepted and ignored. |
| Other endpoints, such as `/v1/models`, `/v1/embeddings`, `/v1/responses`, `/v1/completions` | Not available. Only `POST /v1/chat/completions` is available. |

**Fields the API does not know are refused.** A field that is neither on the [Chat Completions](https://docs.gnani.ai/api/LLM/chat-completions.md) page nor in the table above returns `400 unknown_parameter`, for example `Unrecognized request argument supplied: topk`. A typo in a field name is an error, not a silent no-op.

### Gnani-only

These are not part of OpenAI's API. With OpenAI's Python SDK, pass them in `extra_body`. The Gnani Python SDK is built on it, so its sync and async clients work the same way (see [Python SDK: LLM](https://docs.gnani.ai/python-sdk/llm.md#gnani-only-parameters)). With the JavaScript SDK, put them straight into the request object.

| Field | What it does |
| - | - |
| `{"type": "web_search"}` in `tools` | Lets the model search the web. The service runs the searches itself. See [Web search](https://docs.gnani.ai/api/LLM/web-search.md). |
| `enable_thinking` | Turns thinking on or off. If you send it with `reasoning_effort`, `enable_thinking` wins. |
| `reasoning_budget` | The most tokens the model may spend thinking. |
| `top_k`, `min_p`, `typical_p` | Extra sampling controls. |
| `repetition_penalty`, `no_repeat_ngram_size` | Discourage repeated words and phrases. |

```python Python (OpenAI SDK) theme={null}
completion = client.chat.completions.create(
    model="evon-v3.5",
    messages=[{"role": "user", "content": "Write a two-line poem about the monsoon."}],
    temperature=0.8,
    extra_body={"top_k": 50, "repetition_penalty": 1.1},
)
```

```python Python (Gnani SDK) theme={null}
# GnaniLLMClient; with AsyncGnaniLLMClient, await the call
completion = client.chat.completions.create(
    model="evon-v3.5",
    messages=[{"role": "user", "content": "Write a two-line poem about the monsoon."}],
    temperature=0.8,
    extra_body={"top_k": 50, "repetition_penalty": 1.1},
)
```

```javascript JavaScript (OpenAI SDK) theme={null}
const completion = await client.chat.completions.create({
  model: "evon-v3.5",
  messages: [{ role: "user", content: "Write a two-line poem about the monsoon." }],
  temperature: 0.8,
  top_k: 50,
  repetition_penalty: 1.1,
});
```

***

## Frameworks

Frameworks that can talk to an OpenAI-compatible server work the same way: set the base URL, the API key and the model.

```python LangChain theme={null}
# pip install langchain-openai
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.vachana.ai/v1",
    api_key=os.environ["GNANI_API_KEY"],
    model="evon-v3.5",
    extra_body={"reasoning_effort": "none"},
)
print(llm.invoke("Translate to Hindi: Your payment was successful.").content)
```

```python LlamaIndex theme={null}
# pip install llama-index-llms-openai-like
import os
from llama_index.llms.openai_like import OpenAILike

llm = OpenAILike(
    api_base="https://api.vachana.ai/v1",
    api_key=os.environ["GNANI_API_KEY"],
    model="evon-v3.5",
    is_chat_model=True,
    context_window=65536,  # 131072 on Enterprise plans
)
print(llm.complete("Translate to Hindi: Your payment was successful."))
```

```javascript Vercel AI SDK theme={null}
// npm install ai @ai-sdk/openai
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";

const gnani = createOpenAI({
  baseURL: "https://api.vachana.ai/v1",
  apiKey: process.env.GNANI_API_KEY,
});

const { text } = await generateText({
  model: gnani.chat("evon-v3.5"),
  prompt: "Translate to Hindi: Your payment was successful.",
});
console.log(text);
```

### Voice agents

The Gnani [LiveKit plugin](https://docs.gnani.ai/livekit/introduction.md) and [Pipecat plugin](https://docs.gnani.ai/pipecat/introduction.md) provide Gnani speech-to-text and text-to-speech. For the language model step, use your framework's OpenAI-compatible LLM service with the base URL, API key and model above.

## Related

> [card] [Chat Completions reference](https://docs.gnani.ai/api/LLM/chat-completions.md)
>
> Every request parameter, the response, and code examples.

> [card] [Errors](https://docs.gnani.ai/api/LLM/errors.md)
>
> Both error shapes, and how to handle them in the SDKs.

> [card] [Thinking](https://docs.gnani.ai/api/LLM/thinking.md)
>
> How thinking works, and when to turn it off.

> [card] [Limits](https://docs.gnani.ai/api/LLM/limits.md)
>
> Context size, reply length, rate limits and the daily token quota.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.