openapi-llm
raw JSON → 0.4.3 verified Fri May 01 auth: no python
Convert and invoke OpenAPI specifications as LLM tool/function definitions. Current version 0.4.3. Active development.
pip install openapi-llm Common errors
error AttributeError: module 'openapi_llm' has no attribute 'OpenAPIToolSpec' ↓
cause Old import path or outdated version before v0.4.0
fix
Upgrade to latest version (pip install --upgrade openapi-llm) and use 'from openapi_llm import OpenAPIToolSpec'.
error TypeError: from_spec() got an unexpected keyword argument 'config' ↓
cause Using old openapi-llm version (<0.4.0) that did not accept config parameter.
fix
Upgrade to v0.4.0 or later: pip install --upgrade openapi-llm
Warnings
deprecated OpenAPIToolSpec.from_spec() method signature changed in v0.4.0; old positional args may break. ↓
fix Use keyword arguments: OpenAPIToolSpec.from_spec(spec, config=config).
breaking In v0.4.0, the config parameter became mandatory for authentication. ↓
fix Always provide a Config object with api_key or other required credentials.
gotcha OpenAPI security schemes (e.g., API Key, OAuth) are not automatically handled; you must pass a Config with the correct api_key. ↓
fix Set the api_key in Config for the relevant security scheme as specified in the OpenAPI spec.
Imports
- OpenAPIToolSpec wrong
from openapi_llm.core import OpenAPIToolSpeccorrectfrom openapi_llm import OpenAPIToolSpec - Config
from openapi_llm import Config
Quickstart
import os
from openapi_llm import OpenAPIToolSpec
from openapi_llm import Config
config = Config(api_key=os.environ.get('OPENAI_API_KEY', 'test-key'))
spec = OpenAPIToolSpec.from_url('https://api.example.com/openapi.json', config=config)
tools = spec.to_tools()
print(tools)