Install
openclaw skills install genai-callingUnified interface for all providers and all modalities: use the `genai-calling` skill to operate the published `genai-calling` CLI/SDK across text/image/audio/video/embedding workflows, with support for authenticated local MCP workflows.
openclaw skills install genai-callingThis skill is named genai-calling in this repository.
The runtime package is genai-calling, the Python import path is
gravtice.genai, and the environment variable prefix is
GENAI_CALLING_*.
IMPORTANT: If you rely on project-local .env.* files, run commands in the
directory that contains those files (typically this skill base directory). If
no project-local env file is present, the runtime also falls back to
~/.genai-calling/.env. If you pass runtime env vars (inline/export), working
directory is not restricted.
# 1) Create `.env.local` in this skill directory
(cd "<SKILL_BASE_DIR>" && { test -f .env.local || touch .env.local; })
# 2) Edit `<SKILL_BASE_DIR>/.env.local` and set at least one provider key (see "Configuration Templates" and "Supported Environment Variables").
# Example (OpenAI):
# OPENAI_API_KEY=...
# 3) Text
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai --model openai:gpt-4o-mini --prompt "Hello")
# 4) See what you can use (requires at least one provider key configured)
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai model available --all)
For user-wide defaults shared across projects, create ~/.genai-calling/.env
and put provider credentials there. Project-local .env.* files still win.
If uvx is unavailable, install once and use genai directly:
python -m pip install --upgrade genai-calling
(cd "<SKILL_BASE_DIR>" && genai --model openai:gpt-4o-mini --prompt "Hello")
Configuration is managed via environment variables.
You can set env vars in two ways:
export in shell).env.local, .env.production, .env.development, .env.test, ~/.genai-calling/.env)Recommended for this skill:
~/.genai-calling/.env<SKILL_BASE_DIR>/.env.localRuntime example (inline):
(cd "<SKILL_BASE_DIR>" && OPENAI_API_KEY=... uvx --from genai-calling genai --model openai:gpt-4o-mini --prompt "Hello")
When env files are used, SDK/CLI/MCP loads them automatically with priority (high -> low):
.env.local > .env.production > .env.development > .env.test > ~/.genai-calling/.envProcess env vars override file-based config.
Minimal .env.local (OpenAI text only):
OPENAI_API_KEY=...
GENAI_CALLING_TIMEOUT_MS=120000
Minimal ~/.genai-calling/.env:
OPENAI_API_KEY=...
GOOGLE_API_KEY=
ANTHROPIC_API_KEY=
Notes:
.env.local (add it to .gitignore if needed).~/.genai-calling/.env is user-level config and should hold only values you want shared across projects.OPENAI_API_KEY.Project-local .env.local example:
# Copy only what you need. Do not commit `.env.local`.
# --------------------
# Common
# --------------------
GENAI_CALLING_TIMEOUT_MS=120000
GENAI_CALLING_URL_DOWNLOAD_MAX_BYTES=134217728
# GENAI_CALLING_ALLOW_PRIVATE_URLS=1
# GENAI_CALLING_TRANSPORT=
# --------------------
# Providers
# --------------------
OPENAI_API_KEY=
GOOGLE_API_KEY=
ANTHROPIC_API_KEY=
ALIYUN_API_KEY=
ALIYUN_OAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
VOLCENGINE_API_KEY=
VOLCENGINE_OAI_BASE_URL=https://ark.cn-beijing.volces.com/api/v3
TUZI_BASE_URL=https://api.tu-zi.com
# TUZI_OAI_BASE_URL=https://api.tu-zi.com/v1
# TUZI_GOOGLE_BASE_URL=https://api.tu-zi.com
# TUZI_ANTHROPIC_BASE_URL=https://api.tu-zi.com
TUZI_WEB_API_KEY=
TUZI_OPENAI_API_KEY=
TUZI_GOOGLE_API_KEY=
TUZI_ANTHROPIC_API_KEY=
# --------------------
# MCP Server
# --------------------
GENAI_CALLING_MCP_HOST=127.0.0.1
GENAI_CALLING_MCP_PORT=6001
GENAI_CALLING_MCP_PUBLIC_BASE_URL=
# GENAI_CALLING_MCP_BEARER_TOKEN=
# GENAI_CALLING_MCP_TOKEN_RULES=token1: [openai google]; token2: [openai:gpt-4o-mini]
User-wide ~/.genai-calling/.env example:
OPENAI_API_KEY=
GOOGLE_API_KEY=
ANTHROPIC_API_KEY=
Recommended usage:
~/.genai-calling/.env<SKILL_BASE_DIR>/.env.localGENAI_CALLING_TIMEOUT_MS (default: 120000)GENAI_CALLING_URL_DOWNLOAD_MAX_BYTES (default: 134217728)GENAI_CALLING_ALLOW_PRIVATE_URLS (1/true/yes to allow private/loopback URL download)GENAI_CALLING_TRANSPORT (internal transport marker; MCP server uses mcp, legacy sse is accepted)OPENAI_API_KEYGOOGLE_API_KEYANTHROPIC_API_KEYALIYUN_API_KEYVOLCENGINE_API_KEYALIYUN_OAI_BASE_URL (default: https://dashscope.aliyuncs.com/compatible-mode/v1)VOLCENGINE_OAI_BASE_URL (default: https://ark.cn-beijing.volces.com/api/v3)TUZI_BASE_URL (default: https://api.tu-zi.com)TUZI_OAI_BASE_URL (optional override)TUZI_GOOGLE_BASE_URL (optional override)TUZI_ANTHROPIC_BASE_URL (optional override)TUZI_WEB_API_KEYTUZI_OPENAI_API_KEYTUZI_GOOGLE_API_KEYTUZI_ANTHROPIC_API_KEYGENAI_CALLING_MCP_HOST (default: 127.0.0.1)GENAI_CALLING_MCP_PORT (default: 6001)GENAI_CALLING_MCP_PUBLIC_BASE_URLGENAI_CALLING_MCP_BEARER_TOKENGENAI_CALLING_MCP_TOKEN_RULESQuick guidance:
GENAI_CALLING_TIMEOUT_MSGENAI_CALLING_ALLOW_PRIVATE_URLS if you explicitly want to bypass private URL protectiongenai-mcp-serverModel string is {provider}:{model_id} (example: openai:gpt-4o-mini).
Use this to pick a model by output modality:
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai model available --all)
# Look for: out=text / out=image / out=audio / out=video / out=embedding
If you have not configured any keys yet, you can still view the SDK curated list:
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai model sdk)
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai --model openai:gpt-4o-mini --prompt "Describe this image" --image-path "/path/to/image.png")
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai --model openai:gpt-image-1 --prompt "A red square, minimal" --output-path "/tmp/out.png")
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai --model openai:whisper-1 --audio-path "/path/to/audio.wav")
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai --model openai:tts-1 --prompt "你好" --output-path "/tmp/tts.mp3")
Install:
python -m pip install --upgrade genai-calling
Minimal example:
from gravtice.genai import Client, GenerateRequest, Message, OutputSpec, Part
client = Client()
resp = client.generate(
GenerateRequest(
model="openai:gpt-4o-mini",
input=[Message(role="user", content=[Part.from_text("Hello")])],
output=OutputSpec(modalities=["text"]),
)
)
print(resp.output[0].content[0].text)
Note: Client() loads project-local .env.* from the current working
directory and then falls back to ~/.genai-calling/.env; run your script in
the directory that contains your project env files, or export env vars in the
process environment.
Start server (Streamable HTTP: /mcp, SSE: /sse):
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai-mcp-server)
Recommended: set auth via runtime env vars, .env.local, or
~/.genai-calling/.env before exposing the server:
# GENAI_CALLING_MCP_BEARER_TOKEN=sk-...
Debug with MCP CLI:
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai-mcp-cli env)
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai-mcp-cli tools)
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai-mcp-cli call list_providers)
(cd "<SKILL_BASE_DIR>" && uvx --from genai-calling genai-mcp-cli call generate --args '{"request":{"model":"openai:gpt-4o-mini","input":"Hello","output":{"modalities":["text"]}}}')
Set provider credentials via runtime env vars, <SKILL_BASE_DIR>/.env.local,
or ~/.genai-calling/.env (see "Supported Environment Variables"), then retry.
If you see cannot detect ... mime type, verify the path exists and is a valid image/audio/video file.
Increase GENAI_CALLING_TIMEOUT_MS (runtime env var, .env.local, or
~/.genai-calling/.env) and retry.
Binary outputs may be returned as URLs. Private/loopback URLs are rejected by default. Only if you understand the risk, set GENAI_CALLING_ALLOW_PRIVATE_URLS=1.
Set GENAI_CALLING_MCP_BEARER_TOKEN (or GENAI_CALLING_MCP_TOKEN_RULES) via
runtime env var, .env.local, or ~/.genai-calling/.env, and ensure
genai-mcp-cli uses the same token.