Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wick3dr0se/openai-nim

OpenAI API for Nim
https://github.com/wick3dr0se/openai-nim

nim nim-lang nim-library nimble openai openai-api

Last synced: 9 days ago
JSON representation

OpenAI API for Nim

Awesome Lists containing this project

README

        


OpenAI-Nim


OpenAI API for Nim


## Acquisition
Install with Nimble
```bash
nimble install https://github.com/wick3dr0se/openai-nim@#head
```

Install from source
```bash
git clone https://github.com/wick3dr0se/openai-nim; cd openai-nim
```

## Getting Started
Import openai module
```nim
# from nimble
import openai
# or from source
import ./openai
```

Start an asynchronous OpenAI client
```nim
var ai = newAIClient(getEnv("AI_KEY")
```

Text chat with OpenAI
```nim
ai.chat("Say 'test'")
```

Generate an image with DALL-E
```nim
ai.imageGen("Puppy")
```