This guide takes you from API credentials to a completed Giotto response. At the end, you will have installed the Python SDK, configured credentials securely, and sent a request through the Responses API.
Before you begin
You need:
- a Giotto account with API access;
- a positive by-token API credit balance;
- a client ID and client secret from API management;
- Python (3.10 or later); and
- a virtual environment, recommended for local development.
If you have not activated API access, follow the account and purchase instructions in API billing, credits, and usage.
Step 1: Install the Giotto Python SDK
Activate your Python environment and run:
pip install g-client --index-url "https://pip-install:gldt-6Hsbe5WSz3ywYXnEMR_s@gitlab.com/api/v4/projects/80522333/packages/pypi/simple"
Note: Use the current installation command supplied by Giotto. Do not publish a package-index credential unless it is explicitly intended to be public and read-only.
Step 2: Configure your credentials
Set the following environment variables. Replace the placeholder values with the client ID and client secret shown in Giotto.
export GIOTTO_BASE_URL="https://cloud.giotto.ai/api" export GIOTTO_KEYCLOAK_BASE_URL="https://cloud.giotto.ai/keycloak" export GIOTTO_REALM="giotto" export GIOTTO_CLIENT_ID="<YOUR_CLIENT_ID>" export GIOTTO_CLIENT_SECRET="<YOUR_CLIENT_SECRET>"
Environment variables set this way apply to the current terminal session. Configure them through your deployment platform's secrets manager in production.
Keep your secret private. Do not hard-code a real client secret, expose it in client-side code, or commit it to source control. Rotate the secret if it is exposed.
Step 3: Create a Python file
Create a file named quickstart.py with the following code:
from g_client import GiottoClient
client = GiottoClient()
response = client.responses.create(
model="giotto-alto",
instructions="You are a concise technical assistant.",
input="Explain what an API is in two sentences.",
)
print(response.output_text)Step 4: Run the request
python quickstart.py
If the connection succeeds, the script prints a short explanation generated by Giotto. The exact wording can vary.
What the code does
-
GiottoClient()reads the connection settings and credentials. -
responses.create()sends the instructions and user input to the selected model. - The SDK waits until the orchestration request completes.
-
response.output_textreturns the generated text in a convenient form.
Inspect the response
During development, you can inspect common response properties:
print(response.id) print(response.status) print(response.output_text) print(response.to_dict()) print(response.to_json(indent=2))
Avoid logging sensitive user input or complete responses in production unless your data-handling policy permits it.
Troubleshooting
Authentication fails
- Check that all
GIOTTO_*variables are set in the terminal that runs the script. - Confirm that the client ID and secret belong to the intended API product.
- Check for copied spaces or missing characters.
- If the secret was rotated, update the environment variable.
The package cannot be installed
- Confirm the current package index URL and your access to it.
- Check the supported Python version.
- Try the installation in a new virtual environment.
The model is not available
Confirm the model name enabled for your account or deployment. Replace giotto-alto with the supported model identifier supplied by Giotto.
The request has insufficient balance
Check your by-token credit balance on cloud.giotto.ai. New requests are rejected at zero balance; requests already in progress complete. See API billing, credits, and usage.
Comments
0 comments
Please sign in to leave a comment.