Skip to main content

Specific AI Python SDK

This SDK supports two main workflows:

  • Platform automation: manage Tasks, Assets (datasets/benchmarks), Trainings, and Models
  • Inference: run inference on deployed Specific AI models

For copy‑paste‑ready deep dives, see optune-sdk/examples/platform/.

Installation

pip install specific-ai

Authentication & configuration

Set these environment variables:

  • SPECIFIC_AI_API_KEY: API key / bearer token for the platform backend
  • SPECIFIC_AI_BASE_URL: platform backend base URL (default in examples: https://platform.specific.ai/)

Optional:

5-line quickstart (platform)

import os
from specific_ai import SpecificAIClient

client = SpecificAIClient(base_url=os.getenv("SPECIFIC_AI_BASE_URL", "http://localhost:8000"), api_key=os.environ["SPECIFIC_AI_API_KEY"])
task_id = client.tasks.list()[0].iter_tasks()[0].task_id
print(client.models.get_metrics(task_id=task_id).versions)

Which URL goes where

SpecificAIClient takes three different URLs. They are not interchangeable:

Argument Points at Used for
base_url The platform API base, e.g. https://platform.specific.ai/api Tasks, assets, trainings, models
url The SpecificAI gateway root, e.g. https://platform.specific.ai Inference through the gateway, plus tracing and logging
inference_url A Triton server you can reach directly, e.g. http://triton:8000 Inference only, bypassing the gateway

inference_url vs url

  • url — for the SpecificAI gateway. The SDK derives the Triton path for you. On the SpecificAI-hosted platform that path names the workspace the model was deployed from, so that two customers deploying the same project and task name still get one URL each; the SDK asks the platform for it on its first inference (GET {url}/public/api/inference_path, authenticated with your API key) and keeps the answer. You never handle a workspace id, and against a self-hosted install nothing changes: inference goes to {url}/public/triton/v2/models/... exactly as before.
  • inference_url — for direct Triton connections only. When set it is used verbatim as the Triton base, so inference goes to {inference_url}/v2/models/.... Never point it at the gateway: the extra /public/triton hop would be missing and every request would 404.
from specific_ai import SpecificAIClient

# Through the gateway — the SDK derives the Triton path for you.
client = SpecificAIClient(url="https://platform.specific.ai", api_key="sk-...")

# Straight to a Triton you can reach (in-cluster, port-forward, local Docker).
client = SpecificAIClient(inference_url="http://triton:8000")

inference_url is client-side configuration: it changes which host the SDK calls and nothing else. Tracing and logging always go through the gateway, so trace=True and the log_* methods require url — an inference_url-only client raises ValueError if you ask it to log.

Both modes can be combined with base_url in one client when you need platform automation and inference from the same object.

inference_url requires specific-ai >= 0.3.0. Released 0.2.0 does not accept the argument; see CHANGELOG.md.

Inference & logging

Initialize with url (your SpecificAI platform URL) for inference and logging:

from specific_ai import SpecificAIClient

client = SpecificAIClient(url="<your-specific-ai-service-URL>")

# Run inference on a deployed SpecificAI model:
response = client.create(message="...", task_name="my-task", project_name="my-project")

# Log an interaction from an external (non-SpecificAI) model into the platform.
# Use the task-specific helpers so the usecase is created with the correct task
# type. The record is added to an existing Task or used to bootstrap a new one
# with the same task_name and project_name.
client.log_classification(example="...", task_name="my-task", labels=["Positive"], is_multilabel=False)
client.log_summarization(example="...", task_name="my-summary-task", summary="...")
client.log_entity_recognition(example="...", task_name="my-ner-task", entities=[{"label": "PERSON", "content": "Ada", "start_index": 0}])

# Omit the response to log only the example (for later labeling):
client.log_classification(example="...", task_name="my-task")

See optune-sdk/examples/specific_ai_basic_usage.py and optune-sdk/examples/specific_ai_log_usage.py.

Deep dive examples

Located in optune-sdk/examples/platform/:

  • 01_task_management.py
  • 02_asset_management.py
  • 03_training_workflows.py
  • 04_model_deployment.py

Support

Contact support@specific.ai.

Metadata

Release files for specific-ai 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for specific-ai 0.3.0
File Size Uploaded Provenance Actions
specific_ai-0.3.0.tar.gz 51.1 kB Without provenance Details for specific_ai-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for specific-ai 0.3.0
File Interpreter ABI Platform Actions
specific_ai-0.3.0-py3-none-any.whl Python 3 none any Details for specific_ai-0.3.0-py3-none-any.whl

Total release size: 95.9 kB

Release files / specific_ai-0.3.0.tar.gz

Download URL specific_ai-0.3.0.tar.gz
Size 51.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7b15138167f9a549a34ed25e9d537a248acf9d70ca943132ba8fd200b169a865
BLAKE2b-256 checksum
How to use checksums
3a11d31ad1d08de77a7486a71ef4b7ac52019ff80ff8105ee04ab6f1680cabdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / specific_ai-0.3.0-py3-none-any.whl

Download URL specific_ai-0.3.0-py3-none-any.whl
Size 44.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c951106147b9420d70fa5d9f68452925238941af2efdd3b070083e0d85b756c4
BLAKE2b-256 checksum
How to use checksums
d494084d422df62fe5b0e83bca681e8f1e3b099b009fe13605b90f0b66b16f3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for specific-ai 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page