Python client SDK for JijZept AI.
Project description
jijzeptai
jijzeptai is the Python SDK for submitting optimization jobs and working with
Project files in JijZept AI. It supports CPython 3.11, 3.12, 3.13, and 3.14.
Install
With uv:
uv add jijzeptai
With pip:
python -m pip install jijzeptai
JijModeling and OMMX are included as required dependencies.
Create and configure an API token
In JijZept AI, open the account menu and choose API Tokens. Create a token for the current Organization. The value appears only once, so copy it into your environment with the production JijZept AI URL and do not put it in source code:
export JIJZEPTAI_BASE_URL="https://ai.jijzept.com"
export JIJZEPTAI_API_TOKEN="jza_..."
DeveloperClient reads these variables by default. You can also pass
base_url="https://ai.jijzept.com" and api_token as constructor arguments
when that fits your program better.
Tokens created before this release used the jzsa_ prefix. They are no longer
accepted. Revoke the legacy token, create a replacement in API Tokens, and
update JIJZEPTAI_API_TOKEN with the new jza_ value.
Project files
The client exposes four Project operations. The Organization always comes from the verified API token; these methods do not accept an Organization ID.
from pathlib import Path
from jijzeptai import DeveloperClient
client = DeveloperClient()
projects = client.list_projects()
project_id = projects[0].id
page = client.list_project_files(project_id, path="/data", limit=100)
while page.has_more:
page = client.list_project_files(
project_id,
path="/data",
cursor=page.next_cursor,
limit=100,
)
uploaded = client.upload_file(
project_id,
local_path=Path("input.csv"),
remote_path="/data/input.csv",
overwrite=True,
)
download_directory = Path("downloads")
download_directory.mkdir(exist_ok=True)
saved_path = client.download_file(
project_id,
remote_path=uploaded.path,
local_path=download_directory / "input.csv",
overwrite=True,
)
list_project_files accepts an absolute POSIX-style directory path. Its
cursor is opaque and belongs to the same path and pagination flow. Upload and
download operate on one file only; directories, recursive transfers, and ZIP
operations are not supported. Upload refuses an existing remote path unless
overwrite=True. Download refuses an existing local path unless
overwrite=True and publishes the completed download atomically from a
temporary file. The local path's parent directory must already exist; the SDK
does not create it automatically.
Uploads and downloads use short-lived signed object-storage URLs internally.
The SDK never sends the JijZept AI Authorization header to those URLs.
Minimal model workflow
This flow deploys a reusable JijModeling model, submits input data, waits for
optimization, and downloads the solution. Deploying a model requires an Admin
or Developer Organization Role. If your role is User, ask an Admin or Developer
to deploy the model and share its name and tag, then call
submit_job_by_deployed_model with those values (skip deploy_model).
import jijmodeling as jm
from jijzeptai import DeveloperClient
# Define a reusable knapsack model.
@jm.Problem.define("knapsack", sense=jm.ProblemSense.MAXIMIZE)
def knapsack(problem: jm.DecoratedProblem):
values = problem.Float(ndim=1)
item_count = values.len_at(0)
weights = problem.Float(shape=(item_count,))
capacity = problem.Float()
selected = problem.BinaryVar(
"selected",
shape=(item_count,),
description="item selected",
)
problem += jm.sum(values * selected)
problem += problem.Constraint(
"capacity",
jm.sum(weights * selected) <= capacity,
)
# Create the SDK client for JijZept AI.
client = DeveloperClient()
# Publish the model so the Organization can run it with new input later.
model = client.deploy_model("knapsack", "demo", knapsack)
# Start an optimization job with concrete input values.
job = client.submit_job_by_deployed_model(
model.name,
model.tag,
{
"values": [10.0, 20.0, 15.0, 30.0],
"weights": [2.0, 3.0, 5.0, 7.0],
"capacity": 10.0,
},
)
# Wait until the job succeeds, then download the solution.
finished = client.wait_for_success(job.job_id)
solution = client.download_solution(finished.job_id)
print(solution.extract_decision_variables("selected")) # selected items
print(solution.objective) # best objective value
print(solution.feasible) # True when all constraints hold
Organization roles
- Admin and Developer: deploy, update, archive, and unarchive models; submit a JijModeling problem or an OMMX problem file without deploying a model first; run deployed models.
- User: inspect and run deployed models.
Deployed models belong to the Organization. Jobs, results, and cancellation stay private to the user who submitted the job.
Errors
Catch JijZeptAIError for failures raised by this package, or
JijZeptApiError for an HTTP status, service error code, and response details.
Invalid arguments and local path or overwrite-policy violations raise
TypeError or ValueError. Authentication failures use HTTP 401, permission
failures use HTTP 403, stale FileTree writes use HTTP 409 or 412, and
unverifiable current identity or authorization state uses HTTP 503.
from jijzeptai import JijZeptAIError, JijZeptApiError, TransportError
try:
finished = client.wait_for_success(job.job_id)
except TransportError as error:
print(f"Network request failed: {error}")
except JijZeptApiError as error:
print(f"API request failed ({error.status_code}): {error.message}")
except JijZeptAIError as error:
print(f"JijZept AI operation failed: {error}")
License
Apache-2.0 covers the published jijzeptai package. It does not license the
JijZept AI hosted service, API tokens, user models or data, service terms, or
JIJ Inc. trademarks and the JijZept AI product name.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jijzeptai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: jijzeptai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ddec8405bdff9351c8a62d8b4f13e27e0a18776846511e507a0bd0f205be0af
|
|
| MD5 |
4d5983ffd414e46eda3352f3138b38b2
|
|
| BLAKE2b-256 |
d28e81febeffc9b38df1b96b01114e07eb9722ed35a5b997d8154625d132bc04
|
Provenance
The following attestation bundles were made for jijzeptai-0.2.0-py3-none-any.whl:
Publisher:
publish-python-sdk.yml on Jij-Inc/JijZeptAI-v4
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
jijzeptai-0.2.0-py3-none-any.whl -
Subject digest:
8ddec8405bdff9351c8a62d8b4f13e27e0a18776846511e507a0bd0f205be0af - Sigstore transparency entry: 2264247962
- Sigstore integration time:
-
Permalink:
Jij-Inc/JijZeptAI-v4@0e96d1886ca969b3a48afe031ba5d6ab16f736aa -
Branch / Tag:
refs/tags/python-sdk-v0.2.0 - Owner: https://github.com/Jij-Inc
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@0e96d1886ca969b3a48afe031ba5d6ab16f736aa -
Trigger Event:
push
-
Statement type: