# Client code

We provide client codes in both Python and Javascript.

### Installation[​](https://docs.mistral.ai/platform/client/#installation) <a href="#installation" id="installation"></a>

Follow installation instructions in the repository for our Python Client or Javascript Client.

### Chat Completion[​](https://docs.mistral.ai/platform/client/#chat-completion) <a href="#chat-completion" id="chat-completion"></a>

The chat completion API allows you to chat with a model fine-tuned to follow instructions.

* python
* javascript
* curl

```
from nido.client import NidoClient
from nido.models.chat_completion import ChatMessage

api_key = os.environ["NIDO_API_KEY"]
model = "nido-tiny"

client = NidoClient(api_key=api_key)

messages = [
    ChatMessage(role="user", content="What is the best French cheese?")
]

# No streaming
chat_response = client.chat(
    model=model,
    messages=messages,
)

# With streaming
for chunk in client.chat_stream(model=model, messages=messages):
    print(chunk)
```

We allow users to provide a custom system prompt (see API reference). A convenient `safe_mode` flag allow to force chat completion to be moderated against sensitive content (see Guardrailing).

### Embeddings[​](https://docs.mistral.ai/platform/client/#embeddings) <a href="#embeddings" id="embeddings"></a>

The embeddings API allows you to embed sentences.

* python

```
from nido.client import NidoClient

api_key = os.environ["NIDO_API_KEY"]
client = NidoClient(api_key=api_key)

embeddings_batch_response = client.embeddings(
      model="nido-embed",
      input=["Embed this sentence.", "As well as this one."],
  )
```

## Third-Party Clients

Here are some clients built by the community for various other languages:

### Go[​](https://docs.mistral.ai/platform/client/#go) <a href="#go" id="go"></a>

[Gage-Technologies](https://github.com/Gage-Technologies/mistral-go)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nido.sg/get-started/platform/client-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
