SAGEA LogoDocs & API
Getting Started

Send your first API request

Create an API key, install the SDK, and send a chat completion request.

  • Install the Python or TypeScript SDK
  • Send a request to a SAGEA model
  • Print the model's response

Everything here is the foundation for the agent and document quickstarts that follow.

Time to complete: ~5 minutes

Prerequisites

  • Python 3.9+ or Node.js 18+ installed on your machine.
  • A SAGEA account. Create account
  • A SAGEA API key. Foundry is enabled in Free mode by default, with no credit card required.

Step 1: Get your API key

  1. Open Foundry → API keys.
  2. Click Create new key.
  3. Give the key a name (for example, quickstart) and click Create.
  4. Copy the key to your clipboard. The key appears only once; if you lose it, generate a new one.
  5. Set the key as an environment variable in your terminal:
export SAGEA_API_KEY="your_api_key_here"

Step 2: Install the SDK

pip install sagea

Step 3: Send your first request

Create a file and add the following code:

# quickstart.py
import os
import sagea
 
client = sagea.Client(api_key=os.environ["SAGEA_API_KEY"])
 
response = client.chat.completions.create(
    model="sage-2-4-actus",
    messages=[
        {"role": "user", "content": "What is SAGEA?"}
    ],
)
 
print(response.choices[0].message.content)

Step 4: Run it

python quickstart.py

Verify

The terminal prints a short description of SAGEA. If it doesn't, check the error table below.

ErrorCauseFix
401 UnauthorizedAPI key is incorrect or not setRun echo $SAGEA_API_KEY to confirm the variable is set
429 Too Many RequestsRate limit hitWait and retry with exponential backoff
404 Not FoundWrong base URLUse https://api.sagea.space/v1

What's next

On this page