Mode d’emploi
- Copiez la commande et examinez le paquet avant de l’installer dans votre environnement agent.
- Consultez le document original pour les outils, identifiants et environnements requis.
- Décrivez les entrées et le livrable souhaité ; comparez la sortie aux sources.
npx skills add https://github.com/novainsilico/jinko-skills --skill jinko-sdk-setupAvant de commencer
- L’installation n’inclut ni abonnement au modèle, ni quota API, ni accès aux fichiers.
- Étoiles et installations reflètent l’activité, pas un test indépendant de qualité ou de sécurité.
Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.
Jinkō SDK Setup
Use this skill for SDK setup and credential checks only. Keep the user focused on proving that Python can authenticate against Jinkō and read one project item list before moving to model, vpop, protocol, output-set, or trial workflows.
BE CAREFUL: the right package is jinko-sdk that export a jinko module. jinko is a different package unrelated to the Jinko SDK.
Credentials
Do this before the connection check. JinkoClient() reads credentials from the environment only. The SDK commands (python -m jinko.cli.*) also load a local .env when python-dotenv is installed, except create_document_from_markdown. python-dotenv is not a dependency of jinko-sdk. For that command or your own script, export the variables of .env first (set -a; source .env; set +a), or install python-dotenv and call from dotenv import load_dotenv; load_dotenv() before JinkoClient().
Choose the credential
- If
JINKO_API_KEYis set in the environment or.env, use it. Do not callget_session_code. An API key serves every SDK process for the whole session, so it needs no per-command approval. - Use a session code only when no
JINKO_API_KEYis available and a Jinko MCP server exposesget_session_code. - If neither is available, ask the user to add
JINKO_API_KEYto.env(seeassets/.env.example). Do not ask the user to paste a key into chat.
When both JINKO_API_KEY and JINKO_SESSION_CODE are set, the SDK uses the session code. Do not export a session code when an API key is available.
Choose the project
An API key can be an organization key that reaches several projects, so JINKO_PROJECT_ID is not always set.
- If
JINKO_PROJECT_IDis set, or the user named a project, use it. - Otherwise, run
python -m jinko.cli.check_jinko_connectionwithoutJINKO_PROJECT_ID. It lists the projects the key can see. Show the list and ask the user which project to use. Do not guess a project. - Export the chosen id as
JINKO_PROJECT_IDfor the SDK processes of the task. For work across several projects, useJinkoOrgClientandorg.project(project_id)instead (see "Choosing a client").
Session code (only without an API key)
A session code can be exchanged only once. Call get_session_code immediately before each SDK process, including the connection check and every later command. Do not reuse a code that was already passed to a process.
- Call
get_session_codewith no arguments. - The tool returns JSON with
codeandexpiresAt. ExportcodeasJINKO_SESSION_CODEfor that one process. - Keep the code out of
.env, chat, logs, and version control. - Inside that process the SDK exchanges the code once, keeps the bearer in
JINKO_API_TOKEN, and dropsJINKO_SESSION_CODE. A new process does not see that bearer. Fetch a new code for it. - Also call
get_session_codeagain afterexpiresAt, or when the SDK reports an authentication failure.
Because each SDK process needs a new code, a multi-step workflow on session codes produces one tool call per process. Recommend adding JINKO_API_KEY to .env when the user runs many SDK commands.
Workflow
SDK VERSION PREREQUISITE: Run the check below. It ships with the SDK and verifies the installed SDK against every neighboring SDK-dependent skill before API access.
Run the deterministic check and follow its success or error message:
python -m jinko.cli.check_jinko_connectionThe script:
- Loads
.envwhenpython-dotenvis installed. - Redacts sensitive values when showing configuration.
- Requires
JINKO_API_KEY(a project key or an organization key) or, when no key is available,JINKO_SESSION_CODE. When both credential variables are set,JINKO_SESSION_CODEis used, so do not export a session code next to a key. - Without
JINKO_PROJECT_ID, lists the projects visible to the key withJinkoOrgClient().list_projects(). This list does not show the key scope, so the script does not report the key type. - With
JINKO_PROJECT_ID, constructsJinkoClient(), callsclient.auth_check(), thenclient.search(limit=1, show_table=False, show_table_hint=False)to prove minimal read-only project-item access. - Prints minimal output on success, including the key type when
JINKO_PROJECT_IDis set.
Use --show-config only when debugging local setup; it prints presence and redacted values, never the full API key or session code.
After Validation
Once the connection check passes, prefer client.search(...) for project exploration because it gives the user an immediate view across project items.
Use a minimal example like:
from jinko import JinkoClient
client = JinkoClient()
client.search(limit=20, columns="compact")Use search() when the user wants to:
- browse what exists in the configured project
- find an item by name or free text
- orient themselves before choosing a model, protocol, vpop, or trial workflow
The setup script uses a one-item, non-rendered search() only as its project-read check after authentication. Use a larger interactive search() only for exploration after validation succeeds.
Reading SDK signatures
Import only JinkoClient and/or JinkoOrgClient, and optionally the exceptions from jinko. The SDK has no jinko.model or jinko.models module. Get every other object from the client, then read its signature and docstring when needed with help():
model = client.get_model("cm-...")
help(client.get_model)
help(type(model)) # every method of the returned object
help(model.simple_solve)Import a class from jinko.domain only to name it in a type annotation, for example from jinko.domain import Model. Avoid searching the installed package source for signatures.
Choosing a client
Both clients accept a project key and an organization key, so choose by task. Use JinkoClient() for work in the project that JINKO_PROJECT_ID names. Use JinkoOrgClient when JINKO_PROJECT_ID is unset or the task spans several projects. JinkoOrgClient reads JINKO_API_KEY and JINKO_BASE_URL only:
from jinko import JinkoOrgClient
org = JinkoOrgClient()
for project in org.list_projects():
print(project.id, project.name)
client = org.project(project.id) # a JinkoClient for that projectUse org.auth_check() to read the key's declared scope without a project ID. list_projects() can include projects outside that scope. In a multi-project workflow, call client.auth_check() on each project client and catch AuthenticationError to skip an out-of-scope project. Then request a project resource to verify actual access. Authentication responses without key metadata receive a credential check only.
Troubleshooting
Run the check again and act on its deterministic diagnostic. Do not replace it with ad hoc checks or ask the user to share secrets.
