Getting started

Authentication

The API uses API keys for authentication. Contact [email protected] to get API Keys.

Always keep your API key confidential! Never display it in publicly accessible areas like client-side scripts or mobile apps. For live operations, ensure your API key is accessed securely, preferably from a backend server, using environmental variables or a key management system.

All API requests should include your API key in an Authorization HTTP header as follows:

Authorization: Bearer API_KEY

Making requests

You can make an API call by specifying the model owner and the model in the model parameters. Please keep in mind to replace $API_KEY with your API key.

OpenAI gpt-3.5-turbo

curl https://api.platform.a15t.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
     "model": "openai/gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'
   

Anthropic claude-2

curl https://api.platform.a15t.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
     "model": "anthropic/claude-2",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'
   

Starting using OpenAI Python Library

pip install openai>=1.0.0

Completions

from openai import OpenAI

client = OpenAI(
  api_key="sk-...",
  base_url="https://api.platform.a15t.com/v1",
)

completion = client.completions.create(model="openai/gpt-3.5-turbo-instruct", prompt="Hello world")
print(completion.choices[0].text)

Chat completions

from openai import OpenAI

client = OpenAI(
  api_key="sk-...",
  base_url="https://api.platform.a15t.com/v1",
)

completion = client.chat.completions.create(model="anthropic/claude-2", messages=[{"role": "user", "content": "Hello world"}])
print(completion.choices[0].message.content)

Embeddings

from openai import OpenAI

client = OpenAI(
  api_key="sk-...",
  base_url="https://api.platform.a15t.com/v1",
)

embeddings = client.embeddings.create(model="openai/text-embedding-3-small", input="Hello world", dimensions=100)
print(embeddings.data[0].embedding)