AGENT SKILL

client-and-api

Use Xinference sync and async Python clients, model handles, and HTTP/OpenAI-compatible APIs safely.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
client-and-api
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Use Xinference sync and async Python clients, model handles, and HTTP/OpenAI-compatible APIs safely.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Client and API

Use this sub-skill when a task is about calling a running Xinference service from Python, cURL, the OpenAI SDK, or another HTTP client. It assumes the target model has already been launched and identified by a model UID.

Use this for

  • Client, AsyncClient, RESTfulClient, and AsyncRESTfulClient usage.
  • launch_model, register_model, list_models, get_model, and terminate_model client signatures.
  • Model handles for chat, text generation, embeddings, rerank, images, audio, video, and flexible model requests.
  • Service-root versus /v1 OpenAI-compatible base URL selection.
  • Streaming response iterators and async iterator handoffs.
  • API key headers and endpoint placeholders in examples.
  • Request-shape validation, including strict system-message ordering and integer-like replica validation.

Route away when needed

  • Service startup, model lifecycle CLI commands, and supervisor/worker cluster orchestration: serving-and-cli.
  • Model family, engine, format, quantization, optional extras, LoRA, or custom model JSON decisions: models-and-backends.
  • Auth database bootstrap, OIDC, admin policy, audit logs, metrics, Web UI, or deployment hardening: operations-and-security.

Working pattern

  1. Confirm the service endpoint root, for example http://<host>:9997.
  2. Confirm the model UID returned by launch/list operations.
  3. Pick the API surface:
    • Xinference Python client: endpoint root.
    • OpenAI-compatible SDK/cURL: endpoint root plus /v1.
    • Direct HTTP family endpoints: use the family-specific reference.
  4. Add Authorization: Bearer <token-or-api-key> only when auth is enabled.
  5. Keep examples placeholder-only until the user supplies a real endpoint, model UID, and API key policy.
  6. If a request fails, classify the failure as endpoint/base-url, auth, model-UID, request-shape, streaming, or backend/model-readiness before changing code.

Core rules

  • A launched model UID is required for every request family.
  • The OpenAI-compatible base URL should end in /v1; the Xinference Client constructor uses the service root.
  • RESTfulClient is a compatibility alias for Client; AsyncRESTfulClient is an alias for AsyncClient.
  • In this inspected build, the sync Client.launch_model exposes virtual-env launch knobs that the async launch signature does not mirror exactly. Check references/api-reference.md before assuming parity.
  • Treat rerank as a Xinference HTTP/client workflow, not a universal OpenAI SDK helper.
  • Do not make live network calls from bundled helper scripts; they render snippets only.

References

  • API reference for verified signatures and model handle method notes.
  • OpenAI-compatible API for /v1 base URL shape and request-family templates.
  • Client workflows for sync/async launch, list/get, model handle, streaming, and registration flows.
  • Troubleshooting for 401/403, 404, strict message order, replica, streaming, and OCR response issues.

Snippet helper

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351