| 49 | } |
| 50 | |
| 51 | class AnthropicInferenceClient implements InferenceClient { |
| 52 | constructor(private readonly anthropic: Anthropic) {} |
| 53 | |
| 54 | createMessage( |
| 55 | ...args: InferenceCreateMessageArgs |
| 56 | ): InferenceCreateMessageResult { |
| 57 | return this.anthropic.beta.messages.create(...args) |
| 58 | } |
| 59 | |
| 60 | countTokens( |
| 61 | ...args: InferenceCountTokensArgs |
| 62 | ): InferenceCountTokensResult { |
| 63 | return this.anthropic.beta.messages.countTokens(...args) |
| 64 | } |
| 65 | |
| 66 | listModels(...args: InferenceListModelsArgs): InferenceListModelsResult { |
| 67 | return this.anthropic.models.list(...args) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | function getLegacyOpenAICompatBaseUrl(): string | undefined { |
| 72 | const legacyBaseUrl = process.env.ANTHROPIC_BASE_URL?.trim() |
nothing calls this directly
no outgoing calls
no test coverage detected