capabilities.work

Chat Completion with Model Discovery

A 3-step recipe with Hugging Face. We can help you get access.

Recipe · 3 steps

Chat Completion with Model Discovery

with Hugging Face · Artificial Intelligence Management

Confirm a router model is available and run a chat completion against it.

  1. List the models currently available through the inference providers router so the requested model can be confirmed before billing a completion.
  2. Fetch the requested model record from the router to confirm it exists and is servable. Branches to the chat completion on success.
  3. Send an OpenAI-compatible chat completion request with a system and user message; the router selects the optimal provider automatically.
What you'll need to have ready
  • hfToken: Hugging Face access token used as a Bearer credential.
  • modelId: The model id to run the chat completion against.
  • systemPrompt: Optional system message that sets assistant behavior.
  • userMessage: The user message content to send to the model.
  • maxTokens: Maximum number of tokens to generate.
For your developer

Arazzo workflow hugging-face:chat-completion-with-model-discovery, 3 operations: getV1Models → getV1ModelsByModelId → createChatCompletion. Specs on APIs.io.