BETA

Docs
Documentation

Quick Start

From zero to a working chat completion in under five minutes, with the official Python SDK.

1. Install

terminal
pip install openai

2. Initialize

main.py
from openai import OpenAI

client = OpenAI(
    api_key="apily_your-api-key",  # created on the API page in your account
    base_url="https://apily.pro/v1",          # Apily base URL
)

3. Minimal chat

main.py
response = client.chat.completions.create(
    model="gpt-5.6-sol",  # any id from GET /v1/models
    messages=[
        {"role": "user", "content": "Introduce the API in one sentence"},
    ],
)
print(response.choices[0].message.content)

Or with plain cURL, no SDK required:

terminal
curl https://apily.pro/v1/chat/completions \
  -H "Authorization: Bearer apily_your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-sol","messages":[{"role":"user","content":"ping"}]}'

4. About the response

  • Success — HTTP 200, an OpenAI-compatible JSON body with a choices array.
  • Failure — HTTP 4xx/5xx with an error field (see HTTP Status Codes).

5. Notes

  • base_url must include /v1 — dropping it turns every call into a 404.
  • Model ids come from the Apily catalog (GET /v1/models or the Models page) and may differ from the raw provider id.
  • For token-by-token output, set stream=True — see Python SDK Streaming.