Documentation Index
Fetch the complete documentation index at: https://docs.aihubmix.com/llms.txt
Use this file to discover all available pages before exploring further.
Dirección de descarga: https://www.langchain.com/
API_SECRET_KEY = "sk-pvMtoVO******66249058b93C766F2D70167"
BASE_URL = "https://aihubmix.com/v1"; #Base URL for aihubmix
os.environ["OPENAI_API_KEY"] = API_SECRET_KEY
os.environ["OPENAI_BASE_URL"] = BASE_URL
Nota: asegúrate de añadir /v1 al final de openai_api_base.
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(
openai_api_base="https://aihubmix.com/v1", # Note, add /v1 at the end
openai_api_key="sk-3133f******fee269b71d",
)
res = llm.predict("hello")
print(res)
Código de ejemplo para usar un LLM y realizar predicciones.
La clave está, en realidad, en establecer la clave y la URL.
Los métodos incluyen:
- Configurar mediante variables de entorno
- Pasar variables
- Establecer manualmente las variables de entorno
import os
import requests
import time
import json
import time
from langchain.llms import OpenAI
API_SECRET_KEY = "your key from aihubmix";
BASE_URL = "https://aihubmix.com/v1"; #Base URL for aihubmix
os.environ["OPENAI_API_KEY"] = API_SECRET_KEY
os.environ["OPENAI_API_BASE"] = BASE_URL
def text():
llm = OpenAI(temperature=0.9)
text = "What would be a good company name for a company that makes colorful socks?"
print(llm(text))
if __name__ == '__main__':
text();
Después de ejecutarlo, verás la respuesta:
Última actualización: 2026-06-01