AIDMX speaks the OpenAI-compatible protocol your SDKs and agents already understand. Pick an integration, copy the configuration, and route.
Use a AIDMX inference key and a model ID available in your workspace. Replace the example key and model with your own values.
Before using a snippet, create an ordinary workspace inference key and set AIDMX_API_KEY locally. Query /models?task_type=chat&available_only=true with that key, then set AIDMX_MODEL_ID to an exact returned ID, including its vendor prefix. UI and YAML examples use MODEL_ID_FROM_CATALOG as a placeholder to replace manually.
Follow the setup instructions and official references for your client. Choose a protocol and features supported by the selected model. Check wallet capacity or active plan points, then send a short message and confirm it in Activity; model calls can incur charges.
7configuration examples
OSDK
OpenAI SDK
Use the official Python or JavaScript SDK without changing your application interface.
Install openai with pip. This Python example makes one paid chat request after you set the two environment variables described above.
For JavaScript, pass the same baseURL and apiKey to the openai client. Client SDK support does not imply every provider-specific feature is available.
Route terminal pair-programming sessions through any model in your AIDMX catalog.
Run in a macOS/Linux shell after installing Aider and setting the variables above. On Windows, set the variables using your shell's syntax.
The first openai/ is Aider's provider prefix; retain the entire AIDMX model ID after it, including any vendor/ prefix. Choose a model suitable for coding tasks.
Connect the VS Code coding agent with its OpenAI-compatible provider option.
Open Cline settings and choose OpenAI Compatible. Replace the key and model placeholders; keep /api/v1 in the base URL.
Set context, output limits and image support from the selected endpoint's capabilities, then test a disposable task before enabling automatic file operations.
text
Provider: OpenAI Compatible
Base URL: https://stg-api.modelmix.tech/api/v1
API key: mmk-...
Model ID: MODEL_ID_FROM_CATALOG
Expose your routed model catalog inside a multi-user, open-source chat workspace.
Merge endpoints.custom into your project-root librechat.yaml, retaining the config version required by your LibreChat release. Replace MODEL_ID_FROM_CATALOG with a current full model ID.
Set AIDMX_API_KEY in LibreChat's protected configuration, then select AIDMX in the app. Add more explicit chat models as needed.
Use AIDMX as the OpenAI endpoint behind a self-hosted conversational interface.
These are service/container environment settings. Replace the key and ensure they are passed to Open WebUI, then start or recreate the service.
For an existing installation, edit its saved OpenAI connection in Admin settings. Persisted connection settings can override changed environment variables; select and verify a currently available chat model.
Build chains and agents while AIDMX manages provider selection and fallbacks.
Install langchain-openai with pip and set the variables above. This example sends one paid Chat Completions request.
This covers standard chat fields. Provider-specific reasoning/signature fields and built-in tools need separate compatibility checks; a successful text reply does not verify a complete agent workflow.
python
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model=os.environ["MODELMIX_MODEL_ID"],
base_url="https://stg-api.modelmix.tech/api/v1",
api_key=os.environ["MODELMIX_API_KEY"],
max_tokens=256,
)
print(llm.invoke("Hello").content)
Connect retrieval and agent workflows through an OpenAI-compatible LLM adapter.
Install llama-index-llms-openai-like with pip and set the variables above. is_chat_model=True selects the chat interface; the example makes one paid request.
For tool-based agents, set is_function_calling_model=True only after verifying tools support on the selected endpoint. Set context_window from the endpoint before sending long documents; the framework default is not the model's capacity.
python
import os
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
model=os.environ["MODELMIX_MODEL_ID"],
api_base="https://stg-api.modelmix.tech/api/v1",
api_key=os.environ["MODELMIX_API_KEY"],
is_chat_model=True,
is_function_calling_model=False,
max_tokens=256,
)
print(llm.complete("Hello").text)
If it accepts a base URL, it probably already works.
Start with the OpenAI-compatible setup. If a client needs a dedicated adapter, document its request format and add it without changing the routing core.