diff --git a/docs/inference-providers/_toctree.yml b/docs/inference-providers/_toctree.yml index 4623dd474f..af2273fd37 100644 --- a/docs/inference-providers/_toctree.yml +++ b/docs/inference-providers/_toctree.yml @@ -36,8 +36,12 @@ sections: - local: integrations/index title: Overview - - local: integrations/adding-integration - title: Add Your Integration + - local: integrations/pi + title: Pi + - local: integrations/opencode + title: OpenCode + - local: integrations/codex + title: Codex - local: integrations/claude-code title: Claude Code - local: integrations/hermes-agent @@ -46,14 +50,12 @@ title: NeMo Data Designer - local: integrations/macwhisper title: MacWhisper - - local: integrations/opencode - title: OpenCode - - local: integrations/pi - title: Pi - local: integrations/visionagents title: Vision Agents - local: integrations/vscode title: VS Code with GitHub Copilot + - local: integrations/adding-integration + title: Add Your Integration - local: tasks/index title: Inference Tasks diff --git a/docs/inference-providers/index.md b/docs/inference-providers/index.md index 4572e7c280..9f65ac6575 100644 --- a/docs/inference-providers/index.md +++ b/docs/inference-providers/index.md @@ -7,6 +7,33 @@ Hugging Face’s Inference Providers give developers access to hundreds of machine learning models, powered by world-class inference providers. They are also integrated into our client SDKs (for JS and Python), making it easy to explore serverless inference of models on your favorite providers. +## Quick Setup for Agents + +Using a coding agent? Point it at Inference Providers to run [the latest open models available](https://huggingface.co/models?inference_provider=all) with a single Hugging Face token. Pick your tool below to jump straight to its setup guide. + +
+ ## Partners Our platform integrates with leading AI infrastructure providers, giving you access to their specialized capabilities through a single, consistent API. Here's what each partner supports: diff --git a/docs/inference-providers/integrations/claude-code.md b/docs/inference-providers/integrations/claude-code.md index 998f1c18d1..f429b50069 100644 --- a/docs/inference-providers/integrations/claude-code.md +++ b/docs/inference-providers/integrations/claude-code.md @@ -1,6 +1,6 @@ # Claude Code -[Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's agentic coding tool that lives in your terminal. It can understand your codebase, edit files, run commands, and handle complex development tasks. By pointing it at Hugging Face Inference Providers, you can use open models like [GLM-5.1](https://huggingface.co/zai-org/GLM-5.1), [Gemma 4](https://huggingface.co/google/gemma-4-31B-it), and more as the backing LLM. +[Claude Code](https://docs.anthropic.com/en/docs/claude-code) is Anthropic's agentic coding tool that lives in your terminal. It can understand your codebase, edit files, run commands, and handle complex development tasks. By pointing it at Hugging Face Inference Providers, you can use any of [the latest open models available](https://huggingface.co/models?inference_provider=all) as your backing LLM. ## Overview @@ -63,9 +63,9 @@ Then start Claude Code: claude ``` -Replace `zai-org/GLM-5.1` with any model available on [Inference Providers](https://huggingface.co/inference/models). You can also append a provider suffix to pin a specific provider (e.g. `MiniMaxAI/MiniMax-M2.7:fireworks-ai`). Setting an explicit provider gives you deterministic routing, while omitting it (e.g. `MiniMaxAI/MiniMax-M2.7`) lets the router fall back to alternative providers for better resilience. +Replace `zai-org/GLM-5.1` with any model available on [Inference Providers](https://huggingface.co/inference/models). You can also append a provider suffix to pin a specific provider (e.g. `MiniMaxAI/MiniMax-M2.7:fireworks-ai`). Setting an explicit provider gives you deterministic routing, while omitting it (e.g. `MiniMaxAI/MiniMax-M2.7`) uses the default `:fastest` policy. With this policy, the router picks the provider with the highest throughput, and automatically fails over if it becomes unavailable. -You can also append a `:cheapest` or `:fastest` suffix to prefer cheaper or faster providers (e.g. `MiniMaxAI/MiniMax-M2.7:cheapest`). +Available policies are `:cheapest`, `:fastest`, or `:preferred`; use one of these suffixes to prefer cheaper, faster, or your preferred-order providers (e.g. `MiniMaxAI/MiniMax-M2.7:cheapest`). > [!TIP] > The `ANTHROPIC_DEFAULT_*_MODEL` variables map to Claude Code's internal model slots (Opus, Sonnet, Haiku), from the most powerful to the quickest. You can assign different models to each slot to balance capability and speed e.g. `zai-org/GLM-5.1` for Opus, `google/gemma-4-31B-it:together` for Sonnet, and `openai/gpt-oss-120b:cerebras` for Haiku. `CLAUDE_CODE_SUBAGENT_MODEL` controls which model is used for sub-agents. diff --git a/docs/inference-providers/integrations/codex.md b/docs/inference-providers/integrations/codex.md new file mode 100644 index 0000000000..a1eb6f47ff --- /dev/null +++ b/docs/inference-providers/integrations/codex.md @@ -0,0 +1,88 @@ +# Codex + +[Codex](https://developers.openai.com/codex) is OpenAI's agentic coding CLI that runs in your terminal, reads and edits your codebase, runs commands, and handles multi-step development tasks. By pointing it at Hugging Face Inference Providers, you can use any of [the latest open models available](https://huggingface.co/models?inference_provider=all) as your backing model. + +## Overview + +Codex lets you define custom model providers in its configuration file. By adding the Hugging Face router as a provider, all Codex requests are routed through Inference Providers, giving you access to a wide range of open models behind an OpenAI-compatible API. + +## Prerequisites + +- Codex CLI installed ([installation guide](https://developers.openai.com/codex)) +- A Hugging Face account with [API token](https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&tokenType=fineGrained) (needs "Make calls to Inference Providers" permission) + +## Configuration + +### Quick Setup + +1. Create a Hugging Face token with Inference Providers permissions at [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&tokenType=fineGrained) + +2. Set your token as an environment variable: + +```bash +export HF_TOKEN=hf_... +``` + +3. Add Hugging Face as a model provider in `~/.codex/config.toml`: + +```toml +[model_providers.huggingface] +name = "Hugging Face" +base_url = "https://router.huggingface.co/v1" +env_key = "HF_TOKEN" +wire_api = "responses" +``` + +4. Create a profile in its own file at `~/.codex/huggingface.config.toml` that selects this provider and a model: + +```toml +model_provider = "huggingface" +model = "openai/gpt-oss-120b" +``` + +> [!NOTE] +> For Codex versions before 0.134.0, you have to define profiles in a `[profiles.