Slier.AI Documents
Home
  • GET STARTED
    • Introduction
    • Quick Start
    • SDKs
  • API REFERENCE
    • API URLs
    • Models
    • Chat
    • Search
    • Images
  • Privacy & Legal
    • How do you use personal data in model training?
    • How long do you store personal data?
Powered by GitBook
On this page
  • Install
  • Chat
  • Search
  • Images
  1. GET STARTED

SDKs

Although we haven't developed our official SDK, our API interface is designed to be fully compatible with OpenAI. This means that you can seamlessly integrate our API into your projects using the OpenAI SDK to make calls to our services.

Here are examples of how to use the OpenAI SDK to call Slier.AI API interface:

Install

Python

pip install openai

Chat

Feel free to input any of our supported models in the 'model' field, including Claude.

Example

Python

import os
import openai

openai.api_base = "https://api.Slier.ai/v1"
# openai.api_base = "https://api.Slier.ai/v2"
openai.api_key = os.getenv("Slier_AI_API_KEY")

completion = openai.ChatCompletion.create(
  model="claude-instant-1",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  stream=False,
  model_params={
    "temperature": 0.8
  }
)

print(completion.choices[0].message)

Search

Our Search model is currently not compatible with the OpenAI SDK. However, you can directly access the API by referring to the API Reference .

Images

Remember to pass the model parameter.

Example

import os
import openai

openai.api_base = "https://api.Slier.ai/v1"
# openai.api_base = "https://api.Slier.ai/v2"
openai.api_key = os.getenv("Slier_AI_API_KEY")

images = openai.Image.create(
  model="dall-e-2",
  prompt="A cute baby sea otter",
  model_params={
    "n": 1,
    "size": "1024x1024"
  }
)
print(images.data)

PreviousQuick StartNextAPI URLs

Last updated 1 year ago