# SDK Integration

## Official Halfred SDKs

Native SDKs built specifically for Halfred with full feature support:

* [**Node.js / TypeScript SDK**](/02-sdk-integration/01-nodejs.md) - Official SDK for JavaScript and TypeScript projects
* [**Python SDK**](/02-sdk-integration/02-python.md) - Official SDK for Python applications

## OpenAI SDK Compatibility

Already using OpenAI? Switch to Halfred with minimal code changes. Also the recommended way to integrate Halfred in languages other than Python and Node.js:

* [**OpenAI SDK Compatibility Guide**](/02-sdk-integration/03-openai-compatibility.md) - Use existing OpenAI client libraries with Halfred

**Supported Languages**: Go, PHP, Ruby, Java, .NET, Rust, and more - any language with an OpenAI SDK can work with Halfred.

## Comparison

| Feature           | Halfred Node.js SDK | Halfred Python SDK | OpenAI SDK            |
| ----------------- | ------------------- | ------------------ | --------------------- |
| Halfred-optimized | ✅                   | ✅                  | ⚠️ Compatibility mode |
| Type safety       | ✅ TypeScript        | ✅ Type hints       | ✅                     |
| Async/await       | ✅                   | ✅                  | ✅                     |
| Profile selection | ✅                   | ✅                  | ✅                     |
| Migration effort  | New install         | New install        | Change endpoint only  |

## Choosing the Right SDK

### Use Halfred Native SDKs When:

* Starting a new project
* You want Halfred-specific features and optimizations
* You need the latest features first
* You want official support and documentation

### Use OpenAI SDK Compatibility When:

* You have existing OpenAI integration
* You want a drop-in replacement with minimal changes
* Your team is already familiar with OpenAI SDK
* You need to support both OpenAI and Halfred endpoints
* **You're working in a language other than Python or Node.js** (Go, PHP, Ruby, Java, .NET, etc.)

## REST API Alternative

If you prefer direct HTTP calls or your language isn't supported yet, use our REST API:

* [**REST API Reference**](/04-api-reference/01-endpoints.md) - Complete HTTP API documentation

## Coming Soon

We're working on SDKs for:

* Flutter
* Kotlin
* Swift

Want to see support for a specific language? [Let us know](mailto:support@halfred.ai)!

## Support

Need help with integration?

* **Email**: <support@halfred.ai>
* **Discord**: [Join our community](https://discord.gg/wS2awX4EV7)
* **Examples**: Check out our [GitHub examples repository](https://github.com/halfred-ai/examples)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.halfred.ai/02-sdk-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
