Loading...

Docs · Integrations

llm CLI with TopxAI: extra-openai-models.yaml

Register TopxAI models in llm’s extra-openai-models.yaml with api_base https://ai.topxea.com/v1, store the key with llm keys set, and prompt from the shell.

Simon Willison's llm reads extra OpenAI-compatible models from a YAML file in its config directory. Each TopxAI model is one entry.

Register the models

llm keys set topxai            # paste a TopxAI key on the Auto route
cat > "$(dirname "$(llm keys path)")/extra-openai-models.yaml" <<'EOF'
- model_id: claude-sonnet-5-5
  model_name: claude-sonnet-5-5
  api_base: https://ai.topxea.com/v1
  api_key_name: topxai
  supports_tools: true
  vision: true
- model_id: gpt-6.1-sol
  model_name: gpt-6.1-sol
  api_base: https://ai.topxea.com/v1
  api_key_name: topxai
  supports_tools: true
  vision: true
- model_id: kimi-k3.1-pro
  model_name: kimi-k3.1-pro
  api_base: https://ai.topxea.com/v1
  api_key_name: topxai
  supports_tools: true
EOF
llm models | grep -i topxea

api_key_name points at the key stored with llm keys set, so the YAML holds no secret. model_id is the name you use on the command line; model_name is what is sent to TopxAI. They can differ (model_id: sonnet) if you want a short alias.

Prompt

llm -m claude-sonnet-5-5 "Say hello in one sentence."
llm -m gpt-6.1-sol -s "Answer in JSON" "List three ports of Portugal"
cat main.go | llm -m kimi-k3.1-pro "Explain this file"

llm logs -n 1 shows the last request and response; the charge is in the TopxAI usage log.

Responses API

Add responses: true to a GPT entry to send it through /v1/responses instead of Chat Completions; TopxAI serves both for the GPT models.

If it fails

Models: claude-sonnet-5-5, gpt-6.1-sol · Models & pricing

Related

Previous: n8n with TopxAI: an OpenAI credential with a base URL · Next: Shared pool, official line and auto route

Other languages: 简体中文