# SDK

Page: https://galatea.co/api/docs/sdk

The official OpenAI SDK pointed at this API: install it, then change the base URL and the key.

The chat API speaks the OpenAI wire format, so the client for every language is the official OpenAI SDK. Two values change from an existing OpenAI integration: the base URL becomes the one below, and the key becomes a Galatea key. Streaming, tools and JSON mode are the OpenAI SDK's own, unchanged.

## Install

```shell
pip install openai
```

```shell
npm install openai
```

There is no Galatea-specific package. Any OpenAI SDK current enough to take a base URL works, in any language; the guides on this site show Python and TypeScript.

## Five lines

List the models this key can call, then make one request. Both answer any key; the keys, activity and billing groups take a management key, and the reference names the permission each one needs.

```python
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.galatea.co/v1", api_key=os.environ["GALATEA_API_KEY"])
print(len(client.models.list().data), "models")
reply = client.chat.completions.create(model="deepseek-v4.1-flash-1017-uncensored", messages=[{"role": "user", "content": "Say hello."}])
print(reply.choices[0].message.content)
```

```typescript
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.galatea.co/v1", apiKey: process.env.GALATEA_API_KEY });
console.log((await client.models.list()).data.length, "models");
const reply = await client.chat.completions.create({ model: "deepseek-v4.1-flash-1017-uncensored", messages: [{ role: "user", content: "Say hello." }] });
console.log(reply.choices[0]?.message.content);
```

## The rest of the API

Keys, activity, credits and billing have no OpenAI equivalent, so they are plain JSON over HTTPS. Send the same Authorization header and read the answer as the reference page describes it.

```curl
curl https://api.galatea.co/v1/billing/credits -H "Authorization: Bearer $GALATEA_API_KEY"
```

```curl
curl "https://api.galatea.co/v1/activity?limit=5" -H "Authorization: Bearer $GALATEA_MANAGEMENT_KEY"
```

[Managing keys and reading activity](https://galatea.co/api/docs/keys-and-activity)

[The API reference](https://galatea.co/api/docs/reference)
