> ## Documentation Index
> Fetch the complete documentation index at: https://docs.electronhub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get started with Electron Hub API in minutes

<Steps>
  <Step title="Get Your API Key">
    Create your free account at [app.electronhub.ai](https://app.electronhub.ai)

    ### Generate API Key

    Visit the [API Keys section](https://app.electronhub.ai) to generate your first API key.

    <Warning>
      Keep your API key secure! Never share it or include it in client-side code.
    </Warning>
  </Step>

  <Step title="Make Your First Request">
    <CodeGroup>
      ```python Python theme={null}
      import requests

      response = requests.post(
          'https://api.electronhub.ai/v1/chat/completions',
          headers={
              'Authorization': 'Bearer YOUR_API_KEY',
              'Content-Type': 'application/json'
          },
          json={
              'model': 'gpt-3.5-turbo',
              'messages': [
                  {'role': 'user', 'content': 'Hello! How are you?'}
              ]
          }
      )

      print(response.json()['choices'][0]['message']['content'])
      ```

      ```javascript JavaScript theme={null}
      const response = await fetch('https://api.electronhub.ai/v1/chat/completions', {
          method: 'POST',
          headers: {
              'Authorization': 'Bearer YOUR_API_KEY',
              'Content-Type': 'application/json'
          },
          body: JSON.stringify({
              model: 'gpt-3.5-turbo',
              messages: [
                  { role: 'user', content: 'Hello! How are you?' }
              ]
          })
      });

      const data = await response.json();
      console.log(data.choices[0].message.content);
      ```

      ```bash cURL theme={null}
      curl https://api.electronhub.ai/v1/chat/completions \
        -H "Authorization: Bearer YOUR_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "model": "gpt-3.5-turbo",
          "messages": [
            {"role": "user", "content": "Hello! How are you?"}
          ]
        }'
      ```
    </CodeGroup>
  </Step>

  <Step title="Explore Different Models">
    ### Chat Models

    Perfect for conversations and text generation:

    * **GPT-4**: Most capable, best for complex tasks
    * **GPT-3.5-turbo**: Fast and cost-effective
    * **Claude 3**: Great for analysis and reasoning

    ### Example: Using GPT-4

    ```python theme={null}
    response = requests.post(
        'https://api.electronhub.ai/v1/chat/completions',
        headers={
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        json={
            'model': 'gpt-4',
            'messages': [
                {'role': 'user', 'content': 'Explain quantum computing in simple terms'}
            ]
        }
    )
    ```
  </Step>

  <Step title="Try Image Generation">
    Generate images from text descriptions:

    ```python theme={null}
    response = requests.post(
        'https://api.electronhub.ai/v1/images/generations',
        headers={
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        json={
            'prompt': 'A futuristic cityscape at sunset',
            'model': 'dall-e-3',
            'size': '1024x1024'
        }
    )

    image_url = response.json()['data'][0]['url']
    print(f"Generated image: {image_url}")
    ```
  </Step>

  <Step title="Text Embeddings">
    Convert text to vectors for semantic search:

    ```python theme={null}
    response = requests.post(
        'https://api.electronhub.ai/v1/embeddings',
        headers={
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        json={
            'input': 'Your text to embed',
            'model': 'text-embedding-3-small'
        }
    )

    embedding = response.json()['data'][0]['embedding']
    ```
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Authentication Guide" icon="key" href="/getting-started/authentication">
    Learn about API keys and security best practices
  </Card>

  <Card title="Rate Limits" icon="gauge" href="/getting-started/rate-limits">
    Understand rate limits and optimization strategies
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/chat/completions">
    Explore all available endpoints and parameters
  </Card>

  <Card title="Examples" icon="code" href="/examples/chat-examples">
    See practical examples and use cases
  </Card>

  <Card title="Best Practices" icon="star" href="/guides/best-practices">
    Learn optimization and production tips
  </Card>

  <Card title="Contact Support" icon="envelope" href="mailto:support@electronhub.ai">
    Get help from our support team
  </Card>
</CardGroup>

## Troubleshooting

### Common Issues

**401 Unauthorized**

* Check that your API key is correct
* Ensure you're using the `Bearer` prefix
* Verify your key hasn't expired

**429 Rate Limited**

* Slow down your request rate
* Check your usage limits in the dashboard
* Consider upgrading your plan

**400 Bad Request**

* Verify all required parameters are included
* Check parameter types and formats
* Review the API reference for correct syntax

Need more help? Join our [Discord community](https://discord.com/invite/electronhub) or check the [troubleshooting guide](/getting-started/errors).
