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

# JavaScript / Node.js SDK

> Use the EURI npm package or the OpenAI Node.js SDK with EURI.

## Install

<CodeGroup>
  ```bash EURI SDK theme={null}
  npm install euri
  ```

  ```bash OpenAI SDK theme={null}
  npm install openai
  ```
</CodeGroup>

***

## Using the EURI SDK

```javascript theme={null}
import { EuriClient } from 'euri';

const client = new EuriClient({ apiKey: 'YOUR_EURI_API_KEY' });

// Chat completion
const response = await client.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'Hello!' }],
  max_tokens: 100,
});

console.log(response.choices[0].message.content);
```

### Streaming

```javascript theme={null}
import { EuriClient } from 'euri';

const client = new EuriClient({ apiKey: 'YOUR_EURI_API_KEY' });

const stream = await client.chat.completions.create({
  model: 'gemini-2.5-flash',
  messages: [{ role: 'user', content: 'Write a short poem.' }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}
```

***

## Using the OpenAI SDK

EURI is fully OpenAI-compatible. Just set the `baseURL`:

```javascript theme={null}
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_EURI_API_KEY',
  baseURL: 'https://api.euron.one/api/v1/euri',
});

// Chat
const chat = await client.chat.completions.create({
  model: 'claude-sonnet-4-6',
  messages: [{ role: 'user', content: 'Explain REST APIs.' }],
});
console.log(chat.choices[0].message.content);

// Embeddings
const embedding = await client.embeddings.create({
  model: 'text-embedding-3-small',
  input: 'Hello world',
});
console.log(embedding.data[0].embedding.slice(0, 5));

// Image generation
const image = await client.images.generate({
  model: 'gemini-3-pro-image-preview',
  prompt: 'A mountain landscape at dawn',
  n: 1,
});
console.log(image.data[0].url);
```

<Card title="npm" icon="npm" href="https://www.npmjs.com/package/euri">
  View the EURI JavaScript SDK on npm.
</Card>
