Connect Helicone with Anthropic, a platform for running open-source language models. Monitor and optimize your AI applications using Anthropic’s powerful models through a simple base_url configuration.
This integration method is maintained but no longer actively developed. For the best experience and latest features, use our new AI Gateway with unified API access to 100+ models.
Python
Node (TS)
cURL
Langchain
Change the api url and add a Helicone-Auth header
import anthropicclient = anthropic.Client( api_key="<Anthropic API Key>", base_url="https://anthropic.helicone.ai/v1")res = client._request_as_json( "post", "v1/complete", params={ "prompt": f"{anthropic.HUMAN_PROMPT} How many toes do dogs have?{anthropic.AI_PROMPT}", "stop_sequences": [anthropic.HUMAN_PROMPT], "model": "claude-v1", "max_tokens_to_sample": 300, }, headers={ "Helicone-Auth": "Bearer <HELICONE_API_KEY>" })
Node (TS)Change the api base and add a Helicone-Auth header
const anthropic = new Anthropic({baseURL: "https://anthropic.helicone.ai/v1",apiKey: "my api key",defaultHeaders: { "Helicone-Auth": "Bearer <HELICONE_API_KEY>",},});const stream = await anthropic.completions.create({prompt: `${Anthropic.HUMAN_PROMPT} Your prompt here${Anthropic.AI_PROMPT}`,model: "claude-2",stream: true,max_tokens_to_sample: 300,});
Example cURL command
Please make sure to set environment variables for your API keys